Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

In a polygon layer, how can I generate a table of adjacent polygons?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

What I would do is drop the polygon layer into Spatialite, then run a query like:

SELECT p1.PK_UID, p1.Name FROM Polys p1, Polys p2 
WHERE p2.PK_UID=1 AND 
ST_Touches(p1.Geometry, p2.Geometry)=1;

I'm assuming a primary key column named 'pk_uid', and a label column called 'Name'. The above will return all polygons adjacent to (touching) the polygon with ID=1.

Is that what you had in mind?

share|improve this answer
    
It looks like this will work. Can you point me to a tutorial for Spatialite? I found one patterned after a cookbook with Italian data but I got terribly lost when I tried to follow the steps when it came to actually building a database. –  HealthMaps Aug 4 '12 at 19:55
    
There's also this one: bostongis.com/…. And you can always post on the spatialite-users maillist (in Google Groups). What do you mean by "building a database". In the gui you simple click on the "New Database" icon, and you're rady to go. THen click the "Load shapefile" to get shapefile based layers into the db. That's all there is to it. –  Micha Aug 5 '12 at 8:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.