Skip to content

Instantly share code, notes, and snippets.

@pnorman
Created June 27, 2014 09:06
Show Gist options
  • Save pnorman/5e6540705d6f1a99d090 to your computer and use it in GitHub Desktop.
Save pnorman/5e6540705d6f1a99d090 to your computer and use it in GitHub Desktop.
Finds route relations and ways where refs disagree on usage of -
SELECT r.id as rid, w.id as wid, r.tags->'ref' as rref, w.tags->'ref' as wref
FROM relations r JOIN relation_members rm on (r.id=rm.relation_id) JOIN ways w on (rm.member_id = w.id and rm.member_type='W')
WHERE r.tags@>hstore('type','route')
AND r.tags@>hstore('route','road')
AND r.tags?'ref'
AND (r.tags->'ref') LIKE '%-%'
AND w.tags?'ref'
AND w.tags?'highway'
AND NOT (w.tags->'ref') LIKE '%-%'
LIMIT 50;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment