Last active
August 29, 2015 14:00
-
-
Save MateoV/11304986 to your computer and use it in GitHub Desktop.
This file contains 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
SELECT *, | |
CASE WHEN (select fid from water where st_contains(water.geom, sub.geom)) IS NOT NULL | |
THEN 1 ELSE 0 END AS maritime | |
FROM (( | |
SELECT (boundary_split.boundary).geom, $way_id*(boundary_split.boundary).path[1] as osm_id, $disputed as disputed | |
FROM | |
(SELECT | |
st_dump(st_split($way_geom, st_linemerge(geom))) AS boundary | |
FROM | |
(SELECT geom FROM coastline WHERE st_intersects(geom, $way_geom)) AS coast) AS boundary_split | |
) UNION ALL ( | |
SELECT $way_geom as geomm, $way_id as osm_id, $disputed as disputed | |
FROM coastline | |
WHERE st_disjoint(coastline.geom, $way_geom) group by geomm | |
)) as sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment