Vector remove small lines

From GRASS-Wiki
Revision as of 07:49, 4 November 2014 by Neteler (talk | contribs) (+v.clean approach)

Jump to: navigation, search

Q: How to remove small vector lines? I want to only delete spurious lines.

A: You may choose from the following approach:

Approach 1:

Considering short vector segments as dangles, use:

  v.clean in={your input vector} tool=rmdangle thresh={your threshold} out={output vector}

Approach 2:

  • use to join broken vector segments into longer segments
  • then use with option=length (line length) to upload the vector segment lengths to the attribute table
  v.db.addcol mypolyline column="length_km double precision" mypolyline type=line option=length units=k column=length_km
  • now use v.extract to extract the longer vector segments into a new map according to a threshold you need. Example: Extract line features longer than 5km (cleans out the noise):
  v.extract in=mypolyline out=mypolyline_over5km type=line where="length_km > 5.0"

Approach 3:

Remove from vector map all lines with length shorter than 50 map units (thresh: threshold distance (coords,snap,query)):

v.edit mymap tool=delete query=length thresh=-1,0,-50 type=line

See also