2

enter image description here

I have a shapefile consisting of polylines. I have managed to explode these polylines (break at there vertices). There are a bunch of lines all over the shapefile which are not connected (shown in the red boxes). Is there a way to delete them automatically. What I mean is not selecting them individually because its difficult to manually locate each and every line which isn't connected.

  • Did you use the tool: Vector> Sample> Spatial Sampling - Tick Include input layer objects related to selected objects? – Cyril Jun 24 at 7:20
3

If you're willing to use GRASS, you can do this with the v.clean module, choosing the rmdangle tool, and a suitable threshold.

# STart GRASS using your polyline shapefile (to determine the coordinate system for a new location)
grass -c polyline.shp YourPathToGISDBASE/YourLocation/YourMapset
# Import the shapefile
v.import polyline.shp output=polylines
# And do the remove dangles operation
v.clean polylines tool=rmdangle thresh=xxxx output=polylines2

The xxxx value is some length that makes sense in your situation: larger than the length of the dangles. You might want to run several times, each time with a slightly larger threshold value, until you find what works.

0

I understand that you have a large road network that you are interested in and would like to discard the 'small networks' that consist of fewer number of links (like the one on the top right).

I would approach the problem like this:

  1. merge all the polylines that touch/intersect (let's say this wields merged_network) - see Join / merge lines that touch and intersect in QGIS
  2. from merged_network I would select the 'large' road network that I am interested in (merged_network_clear)
  3. using merged_network_clear I would select by location all the original polylines that intersect/touch it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.