Last active
August 29, 2015 14:02
-
-
Save pnorman/ebd41f5a1759916a48b5 to your computer and use it in GitHub Desktop.
SQL queries used for determining old-style multipolygon member information
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COPY (SELECT count(DISTINCT w.tags) AS n_tags, r.id, ST_AsText(ST_MakeLine(w.linestring)) | |
FROM relations r | |
JOIN relation_members rm ON (r.id=rm.relation_id) | |
JOIN ways w ON (rm.member_type='W' AND rm.member_role='outer' AND rm.member_id=w.id) | |
WHERE r.tags=hstore('type','multipolygon') | |
GROUP BY r.id | |
HAVING count(DISTINCT w.tags) >= 2 | |
ORDER BY n_tags DESC) TO STDOUT; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment