[GRASSLIST:6790] Re: neighbors of polygons

Radim Blazek blazek at itc.it
Mon May 16 07:50:27 EDT 2005

Daniel Isenegger wrote:
> Hi,
> i work with grass 5.7 having the attribute data in postgres-DB.
> in a polygon-shapefile containing several hundred of polygons i want to 
> analyze for each polygon which neighboring polygons it has. Conceptually 
> i see there 2 cases:
> 1) neighboring polygons sharing a common boundary with the current 
> polygon: these polygons should be selectable by identifying the 
> identifiers of the border-lines of the current polygon and search over 
> all border-lines of all polygons for those identifiers.
> here my question is: how to identify the identifiers of all border-lines 
> of a polygon?

v.category layer=2 type=boundary to assign cat to boundaries
v.to.db option=sides -p

> 2) neighboring polygons not sharing a border with the current polygon: 
> here i thought of creating buffers with increasing sizes around the 
> current polygon and looking for
> - easy case: centers of other polygons located within these buffers
> - computationally more challenging case: arbitrary point of a polygon 
> located within these buffers
> here my questions: this method is not very elegant (conceptual and 
> technical). do you have better ideas for solving a problem like this

use previous boundaries with cats as input for v.to.points
find nearest areas for created points using v.distance


> Many thanks
> dani
> ps i tried to do an approach to do this with v.to.db, but didn't 
> progress much

More information about the grass-user mailing list