Skip to content

Instantly share code, notes, and snippets.

@ljwolf
Created February 21, 2017 09:28
Show Gist options
  • Save ljwolf/d9f8b19704c8443c0f4d8a5145c0080d to your computer and use it in GitHub Desktop.
Save ljwolf/d9f8b19704c8443c0f4d8a5145c0080d to your computer and use it in GitHub Desktop.
sql query for queen adjacency, given a table with geometry in the_geom and an index in geom_uid
select
t1.geom_uid as geom_uid,
t2.geom_uid as neighbor_uid
from
geo6311 as t1,
geo6311 as t2
where
st_touches(t1.the_geom, t2.the_geom);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment