Skip to content

Instantly share code, notes, and snippets.

@00krishna
Created March 16, 2016 20:59
Show Gist options
  • Save 00krishna/42b42fd14e3b846f87a2 to your computer and use it in GitHub Desktop.
Save 00krishna/42b42fd14e3b846f87a2 to your computer and use it in GitHub Desktop.
postgis update query where there is an intersection
update census_tracts_2014
set council_district = t1.dist
from (select council_districts.dist, census_tracts_2014.affgeoid, council_districts.geom
from census_tracts_2014 inner join council_districts
on
ST_Intersects(census_tracts_2014.geom, ST_Transform(council_districts.geom,4269))) t1
where
ST_Intersects(census_tracts_2014.geom, ST_Transform(t1.geom,4269));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment