Difference between revisions of "Vector remove small lines"

From GRASS-Wiki
Jump to: navigation, search
m
Line 14: Line 14:
 
Removes from vector map all lines with length shorter than 50 map units (thresh: threshold distance (coords,snap,query)):
 
Removes from vector map all lines with length shorter than 50 map units (thresh: threshold distance (coords,snap,query)):
 
  {{cmd|v.edit}} mymap tool=delete query=length thresh=-1,0,-50 type=line
 
  {{cmd|v.edit}} mymap tool=delete query=length thresh=-1,0,-50 type=line
 +
 +
== See also ==
 +
 +
* http://gis.stackexchange.com/questions/48265/how-to-find-dead-ends-in-a-road-network
  
 
[[Category:FAQ]]
 
[[Category:FAQ]]
 
[[Category:Vector]]
 
[[Category:Vector]]

Revision as of 07:44, 4 November 2014

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

A1: You may the following approach:

  • use v.build.polylines to join broken vector segments into longer segments
  • then use v.to.db with option=length (line length) to upload the vector segment lengths to the attribute table
  v.db.addcol mypolyline column="length_km double precision"
  v.to.db 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"

A2: Alternative approach:

Removes 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