Add 'tolerance' to Shapefile.Segmentize method to allow for disconnected intersections


In order to properly build a 'connected' street network (for routing), I wanted to use the Shapefile Segmentize function, which is intended to split all polylines at intersections with other polylines.

However, I found that the method only worked when the polylines were properly snapped together. If the digitized streets are just 'close' (and I mean even less than 1/1000 of a meter), but not touching, then the algorithm fails to detect it as a street intersection, and the adjacent polyline is not split.

I have introduced a modification to allow for a tolerance in the proximity of nearby polylines, which (hopefully) results in a fully-connected, segmented street network.


Jerry Faust
August 16, 2019, 12:35 AM
  1. A tolerance parameter was added to the Shapefile Segmentize function

    1. it is optional, so as not to break any existing code

    2. it defaults to zero so that the behavior does not change existing code

  2. The tolerance is specified in meters

    1. the code considers the units-of-measure of the shapefile and converts the specified tolerance (in meters) to the appropriate value in the shapefile’s units-of-measure

  3. Polyline endpoints within the specified tolerance will be snapped to the other nearby polylines

    1. this allows the existing algorithm to properly detect the connection and split the adjacent polyline

    2. the GEOS ‘Snap’ function has been made available in the GEOSHelper class

  4. The documentation has also been updated



Jerry Faust


Jerry Faust



Epic Link


Affects versions


Fix versions