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.
A tolerance parameter was added to the Shapefile Segmentize function
it is optional, so as not to break any existing code
it defaults to zero so that the behavior does not change existing code
The tolerance is specified in meters
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
Polyline endpoints within the specified tolerance will be snapped to the other nearby polylines
this allows the existing algorithm to properly detect the connection and split the adjacent polyline
the GEOS ‘Snap’ function has been made available in the GEOSHelper class
The documentation has also been updated