Created
March 4, 2014 17:39
-
-
Save adam-acosta/9351648 to your computer and use it in GitHub Desktop.
CartoDB PostGIS SQL Intersect. fucking cartodb temp solution to more than one row returned error, see distinctLimitIntersect.sql. not sure if the distinct and limit are both needed, i think at least limit is needed. it won't work with distinct alone.
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
UPDATE table | |
SET city_end = ( | |
SELECT DISTINCT cityname | |
FROM cities | |
WHERE ST_Intersects(the_geom, table.the_geom) | |
LIMIT 1 | |
) |
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
UPDATE gps_end | |
SET city = ( | |
SELECT cityname | |
FROM cities | |
WHERE ST_Intersects(the_geom, gps_end.the_geom) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment