Create concave hull: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
(add v.concave.hull)
m (finetuning)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Q: I have a set of points and would like to compute the concave hull of it.
Q: I have a set of points and would like to compute the '''concave hull''' of it (this is not the convex hull as done by {{cmd|v.hull}}):


A: You can approximate a concave hull through the following steps:
A: You can approximate a concave hull through the following steps:


* create map of lines connecting all points (I find it easier to do this with v.net.visibility, but v.distance works also)
=== GRASS GIS 6 ===
* add a table with a column 'cat' and a column 'length double precision' and categories to these lines (v.db.addtable, v.category)
* create map of lines connecting all points (I find it easier to do this with {{cmd|v.net.visibility}}, but {{cmd|v.distance}} works also)
* upload the length of each line to the table (v.to.db)
* add a table with a column 'cat' and a column 'length double precision' and categories to these lines ({{cmd|v.db.addtable}}, {{cmd|v.category}})
* upload the length of each line to the table ({{cmd|v.to.db}})
* visually identify a length threshold above which the lines should not be used
* visually identify a length threshold above which the lines should not be used
* extract only those lines below that threshold (v.extract where="length<MAXLENGTH)
* extract only those lines below that threshold ({{cmd|v.extract}} where="length<MAXLENGTH)
* convert the lines to boundaries (v.type)
* convert the lines to boundaries ({{cmd|v.type}})
* break overlapping lines (v.clean tool=break, there shouldn't be any duplicate lines, but just in case you can also use rmdupl)
* break overlapping lines ({{cmd|v.clean}} tool=break, there shouldn't be any duplicate lines, but just in case you can also use rmdupl)
* add centroids with the same category value to the boundaries (v.centroids step=0)
* add centroids with the same category value to the boundaries ({{cmd|v.centroids}} step=0)
* dissolve the areas into one (v.dissolve)
* dissolve the areas into one ({{cmd|v.dissolve}})


Alternatively, the addon {{AddonSrc|vector|v.concave.hull|version=7}} creates a concave hull using delaunay triangulation.
=== GRASS GIS 7 ===
 
The addon {{AddonCmd|v.concave.hull}} ({{AddonSrc|vector|v.concave.hull|version=7}}) creates a concave hull using Delaunay triangulation.


The image shows the results:
The image shows the results:

Latest revision as of 13:45, 3 June 2015

Q: I have a set of points and would like to compute the concave hull of it (this is not the convex hull as done by v.hull):

A: You can approximate a concave hull through the following steps:

GRASS GIS 6

  • create map of lines connecting all points (I find it easier to do this with v.net.visibility, but v.distance works also)
  • add a table with a column 'cat' and a column 'length double precision' and categories to these lines (v.db.addtable, v.category)
  • upload the length of each line to the table (v.to.db)
  • visually identify a length threshold above which the lines should not be used
  • extract only those lines below that threshold (v.extract where="length<MAXLENGTH)
  • convert the lines to boundaries (v.type)
  • break overlapping lines (v.clean tool=break, there shouldn't be any duplicate lines, but just in case you can also use rmdupl)
  • add centroids with the same category value to the boundaries (v.centroids step=0)
  • dissolve the areas into one (v.dissolve)

GRASS GIS 7

The addon v.concave.hull (v.concave.hull (src)) creates a concave hull using Delaunay triangulation.

The image shows the results: