Geospatial Modelling Environment

calc.sharedborders (Calculate Shared Polygon Borders)

Calculates the shared border line between two adjacent (or approximately adjacent) polygons, and writes the polyline and unique polygon ID's of the polygons to the output file


This tool identifies the shared border between two adjacent polygons. This is not as straightforward as it sounds. Few polygon datasets explicitly model topology, so each polygon is entirely independent of its neighbours. Hence polygons in, for instance, a shapefile format can overlap each other and often have imperfectly shared borders even if you intend them to be identical (the snapping settings help to resolve this to some extent).

This tool takes each polygon, buffers it by the tolerance you specify, then finds all other polygons that overlap that buffer, and for each one clips it with the buffered polygon to identify the ‘shared border’ between the polygons. Note that the tolerance and buffering is needed to resolve the problem of polygons that are very close together but not quite touching. You must determine a tolerance value that is large enough to resolve this gap issue, but not so large that the tool identifies spurious shared borders.

Note that a shared border is recorded only once, even though the shared border may be slightly different depending upon which polygon the program encounters first. This is an unfortunate characteristic, but one that arises from the fact that the polygon boundaries themselves are imprecise.


calc.sharedborders(in, uidfield, out, tol);

inthe input polygon data source
uidfieldthe unique polygon ID field
outthe output line data source
tolthe tolerance distance in coordinate system units for including non-overlapping boundary lines


calc.sharedborders(in=”C:datacounties.shp”, uidfield=”CNTYID”, out=”C:datacnty_borders.shp”, tol=500);


Please consider making a purchase to support the continued development of these tools  Read more...

Tips on how to use this interface efficiently 


Open Source GIS

Copyright © 2001-2014 Hawthorne L. Beyer, Ph.D., Spatial Ecology LLC    Connect on LinkedIn