an example source data we have a set of polylines digitized in a CAD
package and converted to a shapefile. The dataset has about 4500
features and looks comparatively good (for data captured in CAD). Even
after zooming in quite a lot, there is no problem seen.
The first step we need to go through
with each dataset is to analyze it for topology problems. Problems in
the connectivity in a polyline dataset can be identified using
Nodes - 5100 Dangling nodes found in the original dataset!!!!
function creates a point dataset that contains the end points (nodes)
of all polylines in the source dataset. The points are analyzed and
classified in three groups:
- only one polyline ends in this node
- two lines meet in this node
- three or more polylines are connected to this node
As seen from the resulting nodes, the
connectivity in the dataset is not that good. In locations where
apparently three or more lines connect we have red (dangling) nodes.
we zoom to some of the dangling nodes we will see something like this.
The most common errors - undershoots and overshoots
Clean Polylines - node inserted at intersection
Large fuzzy tolerance used (dashed
line). The dangling segment removed, but a significant shift from the
original coordinates can be seen.
Polylines function will do the
- Create intersections in all
locations where two polylines intersect.
- Resolve self intersecting polylines
- Clean duplicate polylines
- Move the vertices that are closer to
each other than the fuzzy tolerance to the same location
Note: Do not use large Fuzzy/Cluster
tolerance. It might introduce unwanted approximation of the shapes
Clean Dangling Nodes
In some cases (depending on the data)
some of the dangling nodes cannot be removed using the automatic
procedure described here and some manual editing might be required. ET
GeoTools has several tools that will help you to productively fix the
remaining topological problems. See
this video for an example
Dangling Nodes function will do the
- Extend the undershoots to the
closest polyline and create node at the intersection
- Delete overshoots
- Snap nodes if there is a gap in the
- Snap a dangling polyline to the
closest polyline (optional)
STEP 4: Analyze Nodes again. If there
are remaining dangling nodes, repeat steps 3 (with larger
tolerance) and 4.
Clean Pseudo Nodes
Pseudo Nodes function will merge the
polylines that connect into a pseudo node. The function can use
multiple attributes for dissolving polylines and has a variety of
attribute transfer rules that can be very useful when processing
street data, but in this case (preparing the data for polygons ) none
of this is needed.
STEP 6: Analyze Nodes again
Polygons function will create polygons
from the topologically correct dataset created above.
If a point dataset with attribute data
is available, the attributes can be assigned to the polygons using