[GRASS-dev] point cloud analysis: new features

Hi all,

a new spatial index for point data is available in lib/btree2: a
multidimensional search tree, also known as k-d tree.

What is it good for:

- nearest neighbor statistics: test if points are randomly
distributed. The current GRASS addon v.nnstat uses an external k-d
tree from PCL (which in turn uses flann) which finds the approximate,
not the exact nearest neighbor. The new GRASS-native k-d tree always
finds the real nearest neighbor.

- spatial cluster analysis: a point cloud can be partitioned into
separate clusters where points within each cluster are closer to each
other than to points of another cluster. To be implemented.

- point cloud thinning: a sample can be generated from a large point
cloud by specifying a minimum distance between sample points. To be
implemented.

The new k-d tree is now used by v.clean tool=snap (Vect_snap_lines()),
reducing both memory consumption and processing time.

More technical:
the new k-d tree finds the exact nearest neighbor(s), not some
approximation. It supports up to 255 dimensions. It is dynamic, i.e.
points can be inserted and removed at any time. It is balanced to
improve search performance. It provides k nearest neighbor search
(find k neighbors to a given coordinate) as well as radius or distance
search (find all neighbors within radius, i.e. not farther away than
radius to a given coordinate).

Markus M

Great! The spatial cluster analysis option would be really good, e.g. for model evaluation using spatially segregated k-fold cross validation methods.

On 1 January 2015 22:18:39 CET, Markus Metz markus.metz.giswork@gmail.com wrote:

Hi all,

a new spatial index for point data is available in lib/btree2: a
multidimensional search tree, also known as k-d tree.

What is it good for:

- nearest neighbor statistics: test if points are randomly
distributed. The current GRASS addon v.nnstat uses an external k-d
tree from PCL (which in turn uses flann) which finds the approximate,
not the exact nearest neighbor. The new GRASS-native k-d tree always
finds the real nearest neighbor.

- spatial cluster analysis: a point cloud can be partitioned into
separate clusters where points within each cluster are closer to each
other than to points of another cluster. To be implemented.

- point cloud thinning: a sample can be generated from a large point
cloud by specifying a minimum distance between sample points. To be
implemented.

The new k-d tree is now used by v.clean tool=snap (Vect_snap_lines()),
reducing both memory consumption and processing time.

More technical:
the new k-d tree finds the exact nearest neighbor(s), not some
approximation. It supports up to 255 dimensions. It is dynamic, i.e.
points can be inserted and removed at any time. It is balanced to
improve search performance. It provides k nearest neighbor search
(find k neighbors to a given coordinate) as well as radius or distance
search (find all neighbors within radius, i.e. not farther away than
radius to a given coordinate).

Markus M

---

grass-dev mailing list
grass-dev@lists.osgeo.org
[http://lists.osgeo.org/mailman/listinfo/grass-dev](http://lists.osgeo.org/mailman/listinfo/grass-dev)


Sent from my Android device with K-9 Mail. Please excuse my brevity.

Hi Markus,

On 01/01/15 22:18, Markus Metz wrote:

Hi all,

a new spatial index for point data is available in lib/btree2: a
multidimensional search tree, also known as k-d tree.

Excellent news.

What is it good for:

- nearest neighbor statistics: test if points are randomly
distributed. The current GRASS addon v.nnstat uses an external k-d
tree from PCL (which in turn uses flann) which finds the approximate,
not the exact nearest neighbor. The new GRASS-native k-d tree always
finds the real nearest neighbor.

- spatial cluster analysis: a point cloud can be partitioned into
separate clusters where points within each cluster are closer to each
other than to points of another cluster. To be implemented.

I suggest implementing DBSCAN: http://en.wikipedia.org/wiki/DBSCAN
It is density-based and thus produces more useful results than
centroid-based methods (k-means and relatives). It can actually
trace the shapes of spatial clusters (even concave ones) and does
not require a priori knowledge about the number of clusters. It
can also handle noise.

There is a reference implementation (albeit in Java) that you can
use to compare it with other clustering algorithms:

  http://elki.dbs.ifi.lmu.de/

An implementation in C (that I have not tried) is here:

  https://github.com/siddharth950/DBSCAN

The one drawback of DBSCAN is that it needs an efficient spatial
index to perform well -- and you have just taken care of that!

- point cloud thinning: a sample can be generated from a large point
cloud by specifying a minimum distance between sample points. To be
implemented.

The new k-d tree is now used by v.clean tool=snap (Vect_snap_lines()),
reducing both memory consumption and processing time.

I would also like to point out that SAGA GIS is moving into
the same direction, i.e. more efficient processing of very
large point clouds. The latest release includes a number
of new point cloud tools. Perhaps it's worth a look.

Most importantly, SAGA GIS has introduced a new file format,
the SAGA Pointcloud (.spc) format. It is compact and yet
flexible enough for a variety of purposes. I recommend to
consider implementing import/export of this format in GRASS 7,
preferably not via v.in.ogr, to avoid the OGR model conversion
overhead.

If you think this would be an interesting option, then you can
find a summary on our tracker:

  http://gvsigce.sourceforge.net/mantis/view.php?id=595

(we are going to implement ".spc" in gvSIG CE, as well).

Best wishes,

Ben

More technical:
the new k-d tree finds the exact nearest neighbor(s), not some
approximation. It supports up to 255 dimensions. It is dynamic, i.e.
points can be inserted and removed at any time. It is balanced to
improve search performance. It provides k nearest neighbor search
(find k neighbors to a given coordinate) as well as radius or distance
search (find all neighbors within radius, i.e. not farther away than
radius to a given coordinate).

Markus M
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

--
Dr. Benjamin Ducke
{*} Geospatial Consultant
{*} GIS Developer

Spatial technology for the masses, not the classes:
experience free and open source GIS at http://gvsigce.org

On Fri, Jan 2, 2015 at 10:08 AM, Benjamin Ducke <benducke@fastmail.fm> wrote:

Hi Markus,

On 01/01/15 22:18, Markus Metz wrote:

Hi all,

a new spatial index for point data is available in lib/btree2: a
multidimensional search tree, also known as k-d tree.

Excellent news.

What is it good for:

- nearest neighbor statistics: test if points are randomly
distributed. The current GRASS addon v.nnstat uses an external k-d
tree from PCL (which in turn uses flann) which finds the approximate,
not the exact nearest neighbor. The new GRASS-native k-d tree always
finds the real nearest neighbor.

- spatial cluster analysis: a point cloud can be partitioned into
separate clusters where points within each cluster are closer to each
other than to points of another cluster. To be implemented.

I suggest implementing DBSCAN: http://en.wikipedia.org/wiki/DBSCAN
It is density-based and thus produces more useful results than
centroid-based methods (k-means and relatives). It can actually
trace the shapes of spatial clusters (even concave ones) and does
not require a priori knowledge about the number of clusters. It
can also handle noise.

Done in trunk r63952 as v.cluster. It is not a GRASS7 addon because it
does not work with G7.0. At the moment it only identifies and labels
clusters. Connectivity graphs and cluster shapes are not implemented.
In future, I would like to add OPTICS because OPTICS can better handle
different clusters with different densities.

Markus M

There is a reference implementation (albeit in Java) that you can
use to compare it with other clustering algorithms:

  http://elki.dbs.ifi.lmu.de/

An implementation in C (that I have not tried) is here:

  https://github.com/siddharth950/DBSCAN

The one drawback of DBSCAN is that it needs an efficient spatial
index to perform well -- and you have just taken care of that!

- point cloud thinning: a sample can be generated from a large point
cloud by specifying a minimum distance between sample points. To be
implemented.

The new k-d tree is now used by v.clean tool=snap (Vect_snap_lines()),
reducing both memory consumption and processing time.

I would also like to point out that SAGA GIS is moving into
the same direction, i.e. more efficient processing of very
large point clouds. The latest release includes a number
of new point cloud tools. Perhaps it's worth a look.

Most importantly, SAGA GIS has introduced a new file format,
the SAGA Pointcloud (.spc) format. It is compact and yet
flexible enough for a variety of purposes. I recommend to
consider implementing import/export of this format in GRASS 7,
preferably not via v.in.ogr, to avoid the OGR model conversion
overhead.

If you think this would be an interesting option, then you can
find a summary on our tracker:

  http://gvsigce.sourceforge.net/mantis/view.php?id=595

(we are going to implement ".spc" in gvSIG CE, as well).

Best wishes,

Ben

More technical:
the new k-d tree finds the exact nearest neighbor(s), not some
approximation. It supports up to 255 dimensions. It is dynamic, i.e.
points can be inserted and removed at any time. It is balanced to
improve search performance. It provides k nearest neighbor search
(find k neighbors to a given coordinate) as well as radius or distance
search (find all neighbors within radius, i.e. not farther away than
radius to a given coordinate).

Markus M
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

--
Dr. Benjamin Ducke
{*} Geospatial Consultant
{*} GIS Developer

Spatial technology for the masses, not the classes:
experience free and open source GIS at http://gvsigce.org
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Tried it out, and it works like a charm, great!

One question/request, would it be terribly difficult to add an option to compute an user-defined number of clusters of equal size?

···

On Sun, Jan 4, 2015 at 9:02 PM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Fri, Jan 2, 2015 at 10:08 AM, Benjamin Ducke <benducke@fastmail.fm> wrote:

Hi Markus,

On 01/01/15 22:18, Markus Metz wrote:

Hi all,

a new spatial index for point data is available in lib/btree2: a
multidimensional search tree, also known as k-d tree.

Excellent news.

What is it good for:

  • nearest neighbor statistics: test if points are randomly
    distributed. The current GRASS addon v.nnstat uses an external k-d
    tree from PCL (which in turn uses flann) which finds the approximate,
    not the exact nearest neighbor. The new GRASS-native k-d tree always
    finds the real nearest neighbor.

  • spatial cluster analysis: a point cloud can be partitioned into
    separate clusters where points within each cluster are closer to each
    other than to points of another cluster. To be implemented.

I suggest implementing DBSCAN: http://en.wikipedia.org/wiki/DBSCAN
It is density-based and thus produces more useful results than
centroid-based methods (k-means and relatives). It can actually
trace the shapes of spatial clusters (even concave ones) and does
not require a priori knowledge about the number of clusters. It
can also handle noise.

Done in trunk r63952 as v.cluster. It is not a GRASS7 addon because it
does not work with G7.0. At the moment it only identifies and labels
clusters. Connectivity graphs and cluster shapes are not implemented.
In future, I would like to add OPTICS because OPTICS can better handle
different clusters with different densities.

Markus M

There is a reference implementation (albeit in Java) that you can
use to compare it with other clustering algorithms:

http://elki.dbs.ifi.lmu.de/

An implementation in C (that I have not tried) is here:

https://github.com/siddharth950/DBSCAN

The one drawback of DBSCAN is that it needs an efficient spatial
index to perform well – and you have just taken care of that!

  • point cloud thinning: a sample can be generated from a large point
    cloud by specifying a minimum distance between sample points. To be
    implemented.

The new k-d tree is now used by v.clean tool=snap (Vect_snap_lines()),
reducing both memory consumption and processing time.

I would also like to point out that SAGA GIS is moving into
the same direction, i.e. more efficient processing of very
large point clouds. The latest release includes a number
of new point cloud tools. Perhaps it’s worth a look.

Most importantly, SAGA GIS has introduced a new file format,
the SAGA Pointcloud (.spc) format. It is compact and yet
flexible enough for a variety of purposes. I recommend to
consider implementing import/export of this format in GRASS 7,
preferably not via v.in.ogr, to avoid the OGR model conversion
overhead.

If you think this would be an interesting option, then you can
find a summary on our tracker:

http://gvsigce.sourceforge.net/mantis/view.php?id=595

(we are going to implement “.spc” in gvSIG CE, as well).

Best wishes,

Ben

More technical:
the new k-d tree finds the exact nearest neighbor(s), not some
approximation. It supports up to 255 dimensions. It is dynamic, i.e.
points can be inserted and removed at any time. It is balanced to
improve search performance. It provides k nearest neighbor search
(find k neighbors to a given coordinate) as well as radius or distance
search (find all neighbors within radius, i.e. not farther away than
radius to a given coordinate).

Markus M


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Dr. Benjamin Ducke
{} Geospatial Consultant
{
} GIS Developer

Spatial technology for the masses, not the classes:
experience free and open source GIS at http://gvsigce.org


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On 04/01/15 23:00, Paulo van Breugel wrote:

Tried it out, and it works like a charm, great!

One question/request, would it be terribly difficult to add an option to
compute an user-defined number of clusters of equal size?

I think you are looking for a completely different algorithm
there. There are many clustering methods that will produce
exactly k clusters. But what do you mean by size: number of
points per cluster or spatial extent/area?

In both cases, I am not sure how you would reconcile the
two opposing goals: (A) find the actual cluster shapes,
(B) make the cluster shapes so that all clusters are of
equal size.

(please see also my comment to Markus below).

On Sun, Jan 4, 2015 at 9:02 PM, Markus Metz
<markus.metz.giswork@gmail.com <mailto:markus.metz.giswork@gmail.com>>
wrote:

    Done in trunk r63952 as v.cluster. It is not a GRASS7 addon because it
    does not work with G7.0. At the moment it only identifies and labels
    clusters. Connectivity graphs and cluster shapes are not implemented.
    In future, I would like to add OPTICS because OPTICS can better handle
    different clusters with different densities.

Thanks Markus, this is excellent progress.
It seems to me that the approximation of cluster shapes from grouped
points is a generic problem that would best be solved with a separate
module. As long as the shapes are roughly convex, the existing v.hull
should work fine. For concave shapes, AFAIK things become messy because
common methods such as alpha shapes require the user to provide
threshold values.

Cheers,

Ben

    Markus M

    >
    > There is a reference implementation (albeit in Java) that you can
    > use to compare it with other clustering algorithms:
    >
    > http://elki.dbs.ifi.lmu.de/
    >
    > An implementation in C (that I have not tried) is here:
    >
    > https://github.com/siddharth950/DBSCAN
    >
    > The one drawback of DBSCAN is that it needs an efficient spatial
    > index to perform well -- and you have just taken care of that!
    >
    >> - point cloud thinning: a sample can be generated from a large point
    >> cloud by specifying a minimum distance between sample points. To be
    >> implemented.
    >>
    >> The new k-d tree is now used by v.clean tool=snap
    (Vect_snap_lines()),
    >> reducing both memory consumption and processing time.
    >>
    >
    > I would also like to point out that SAGA GIS is moving into
    > the same direction, i.e. more efficient processing of very
    > large point clouds. The latest release includes a number
    > of new point cloud tools. Perhaps it's worth a look.
    >
    > Most importantly, SAGA GIS has introduced a new file format,
    > the SAGA Pointcloud (.spc) format. It is compact and yet
    > flexible enough for a variety of purposes. I recommend to
    > consider implementing import/export of this format in GRASS 7,
    > preferably not via v.in.ogr, to avoid the OGR model conversion
    > overhead.
    >
    > If you think this would be an interesting option, then you can
    > find a summary on our tracker:
    >
    > http://gvsigce.sourceforge.net/mantis/view.php?id=595
    >
    > (we are going to implement ".spc" in gvSIG CE, as well).
    >
    > Best wishes,
    >
    > Ben
    >
    >>
    >> More technical:
    >> the new k-d tree finds the exact nearest neighbor(s), not some
    >> approximation. It supports up to 255 dimensions. It is dynamic, i.e.
    >> points can be inserted and removed at any time. It is balanced to
    >> improve search performance. It provides k nearest neighbor search
    >> (find k neighbors to a given coordinate) as well as radius or
    distance
    >> search (find all neighbors within radius, i.e. not farther away than
    >> radius to a given coordinate).
    >>
    >> Markus M
    >> _______________________________________________
    >> grass-dev mailing list
    >> grass-dev@lists.osgeo.org <mailto:grass-dev@lists.osgeo.org>
    >> http://lists.osgeo.org/mailman/listinfo/grass-dev
    >>
    >
    >
    >
    > --
    > Dr. Benjamin Ducke
    > {*} Geospatial Consultant
    > {*} GIS Developer
    >
    > Spatial technology for the masses, not the classes:
    > experience free and open source GIS at http://gvsigce.org
    > _______________________________________________
    > grass-dev mailing list
    > grass-dev@lists.osgeo.org <mailto:grass-dev@lists.osgeo.org>
    > http://lists.osgeo.org/mailman/listinfo/grass-dev
    _______________________________________________
    grass-dev mailing list
    grass-dev@lists.osgeo.org <mailto:grass-dev@lists.osgeo.org>
    http://lists.osgeo.org/mailman/listinfo/grass-dev

--
Dr. Benjamin Ducke
{*} Geospatial Consultant
{*} GIS Developer

Spatial technology for the masses, not the classes:
experience free and open source GIS at http://gvsigce.org

On Mon, Jan 5, 2015 at 12:17 PM, Benjamin Ducke <benducke@fastmail.fm>
wrote:

On 04/01/15 23:00, Paulo van Breugel wrote:
> Tried it out, and it works like a charm, great!
>
> One question/request, would it be terribly difficult to add an option to
> compute an user-defined number of clusters of equal size?
>

I think you are looking for a completely different algorithm
there. There are many clustering methods that will produce
exactly k clusters. But what do you mean by size: number of
points per cluster or spatial extent/area?

Yes, I was looking at something similar to what the function stratify in
the R spcosa package does: "Methods for partitioning a spatial object into
compact strata by means of k-means. The objective function to minimize is
the mean squared shortest distance (MSSD). Optionally, the strata may be
forced to be of equal size. This facilitates field work in case of
stratified simple random sampling for composites". The key here is to
create as compact strata as possible, optionally of equal size (number of
points per cluster).

In both cases, I am not sure how you would reconcile the
two opposing goals: (A) find the actual cluster shapes,
(B) make the cluster shapes so that all clusters are of
equal size.

(please see also my comment to Markus below).

>
>
> On Sun, Jan 4, 2015 at 9:02 PM, Markus Metz
> <markus.metz.giswork@gmail.com <mailto:markus.metz.giswork@gmail.com>>
> wrote:
>
>
> Done in trunk r63952 as v.cluster. It is not a GRASS7 addon because
it
> does not work with G7.0. At the moment it only identifies and labels
> clusters. Connectivity graphs and cluster shapes are not implemented.
> In future, I would like to add OPTICS because OPTICS can better
handle
> different clusters with different densities.
>

Thanks Markus, this is excellent progress.
It seems to me that the approximation of cluster shapes from grouped
points is a generic problem that would best be solved with a separate
module. As long as the shapes are roughly convex, the existing v.hull
should work fine. For concave shapes, AFAIK things become messy because
common methods such as alpha shapes require the user to provide
threshold values.

Cheers,

Ben

> Markus M
>
> >
> > There is a reference implementation (albeit in Java) that you can
> > use to compare it with other clustering algorithms:
> >
> > http://elki.dbs.ifi.lmu.de/
> >
> > An implementation in C (that I have not tried) is here:
> >
> > https://github.com/siddharth950/DBSCAN
> >
> > The one drawback of DBSCAN is that it needs an efficient spatial
> > index to perform well -- and you have just taken care of that!
> >
> >> - point cloud thinning: a sample can be generated from a large
point
> >> cloud by specifying a minimum distance between sample points. To
be
> >> implemented.
> >>
> >> The new k-d tree is now used by v.clean tool=snap
> (Vect_snap_lines()),
> >> reducing both memory consumption and processing time.
> >>
> >
> > I would also like to point out that SAGA GIS is moving into
> > the same direction, i.e. more efficient processing of very
> > large point clouds. The latest release includes a number
> > of new point cloud tools. Perhaps it's worth a look.
> >
> > Most importantly, SAGA GIS has introduced a new file format,
> > the SAGA Pointcloud (.spc) format. It is compact and yet
> > flexible enough for a variety of purposes. I recommend to
> > consider implementing import/export of this format in GRASS 7,
> > preferably not via v.in.ogr, to avoid the OGR model conversion
> > overhead.
> >
> > If you think this would be an interesting option, then you can
> > find a summary on our tracker:
> >
> > http://gvsigce.sourceforge.net/mantis/view.php?id=595
> >
> > (we are going to implement ".spc" in gvSIG CE, as well).
> >
> > Best wishes,
> >
> > Ben
> >
> >>
> >> More technical:
> >> the new k-d tree finds the exact nearest neighbor(s), not some
> >> approximation. It supports up to 255 dimensions. It is dynamic,
i.e.
> >> points can be inserted and removed at any time. It is balanced to
> >> improve search performance. It provides k nearest neighbor search
> >> (find k neighbors to a given coordinate) as well as radius or
> distance
> >> search (find all neighbors within radius, i.e. not farther away
than
> >> radius to a given coordinate).
> >>
> >> Markus M
> >> _______________________________________________
> >> grass-dev mailing list
> >> grass-dev@lists.osgeo.org <mailto:grass-dev@lists.osgeo.org>
> >> http://lists.osgeo.org/mailman/listinfo/grass-dev
> >>
> >
> >
> >
> > --
> > Dr. Benjamin Ducke
> > {*} Geospatial Consultant
> > {*} GIS Developer
> >
> > Spatial technology for the masses, not the classes:
> > experience free and open source GIS at http://gvsigce.org
> > _______________________________________________
> > grass-dev mailing list
> > grass-dev@lists.osgeo.org <mailto:grass-dev@lists.osgeo.org>
> > http://lists.osgeo.org/mailman/listinfo/grass-dev
> _______________________________________________
> grass-dev mailing list
> grass-dev@lists.osgeo.org <mailto:grass-dev@lists.osgeo.org>
> http://lists.osgeo.org/mailman/listinfo/grass-dev
>
>

--
Dr. Benjamin Ducke
{*} Geospatial Consultant
{*} GIS Developer

Spatial technology for the masses, not the classes:
experience free and open source GIS at http://gvsigce.org
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On Mon, Jan 5, 2015 at 12:17 PM, Benjamin Ducke <benducke@fastmail.fm> wrote:

On Sun, Jan 4, 2015 at 9:02 PM, Markus Metz
<markus.metz.giswork@gmail.com <mailto:markus.metz.giswork@gmail.com>>
wrote:

    Done in trunk r63952 as v.cluster. It is not a GRASS7 addon because it
    does not work with G7.0. At the moment it only identifies and labels
    clusters. Connectivity graphs and cluster shapes are not implemented.
    In future, I would like to add OPTICS because OPTICS can better handle
    different clusters with different densities.

Thanks Markus, this is excellent progress.
It seems to me that the approximation of cluster shapes from grouped
points is a generic problem that would best be solved with a separate
module. As long as the shapes are roughly convex, the existing v.hull
should work fine. For concave shapes, AFAIK things become messy because
common methods such as alpha shapes require the user to provide
threshold values.

This is true, but v.concave.hull [0] could help :wink:

Markus M

[0] https://trac.osgeo.org/grass/browser/grass-addons/grass7/vector/v.concave.hull

On Mon, Jan 5, 2015 at 12:17 PM, Benjamin Ducke <benducke@fastmail.fm> wrote:

On Sun, Jan 4, 2015 at 9:02 PM, Markus Metz
<markus.metz.giswork@gmail.com <mailto:markus.metz.giswork@gmail.com>>
wrote:

    Done in trunk r63952 as v.cluster. It is not a GRASS7 addon because it
    does not work with G7.0. At the moment it only identifies and labels
    clusters. Connectivity graphs and cluster shapes are not implemented.
    In future, I would like to add OPTICS because OPTICS can better handle
    different clusters with different densities.

Thanks Markus, this is excellent progress.

As of r64017, the available clustering methods are
dbscan,dbscan2,density,optics,optics2. I hope the documentation is
clear enough.

Markus M

On 08/01/15 23:46, Markus Metz wrote:

On Mon, Jan 5, 2015 at 12:17 PM, Benjamin Ducke <benducke@fastmail.fm> wrote:

Thanks Markus, this is excellent progress.
It seems to me that the approximation of cluster shapes from grouped
points is a generic problem that would best be solved with a separate
module. As long as the shapes are roughly convex, the existing v.hull
should work fine. For concave shapes, AFAIK things become messy because
common methods such as alpha shapes require the user to provide
threshold values.

This is true, but v.concave.hull [0] could help :wink:

All these great addons !

For this particular one: would it be interesting / possible to integrate it directly into v.hull ?

Moritz

On 08/01/15 23:46, Markus Metz wrote:

[..]

Thanks Markus, this is excellent progress.
It seems to me that the approximation of cluster shapes from grouped
points is a generic problem that would best be solved with a separate
module. As long as the shapes are roughly convex, the existing v.hull
should work fine. For concave shapes, AFAIK things become messy because
common methods such as alpha shapes require the user to provide
threshold values.

This is true, but v.concave.hull [0] could help :wink:

Markus M

[0] https://trac.osgeo.org/grass/browser/grass-addons/grass7/vector/v.concave.hull

Wow. And it's been there for a while. How could I not see that?
I think it's high time that I switch from GRASS 6 to 7.

Nevertheless, since you did all that work on v.cluster in GRASS 6,
maybe it would be worth implementing this:

http://grasswiki.osgeo.org/wiki/Create_concave_hull

... in a GRASS 6 shell script?

I am looking forward to trying the new clustering algorithms,
especially "density" and "optics2"

Many thanks,

Ben

--
Dr. Benjamin Ducke
{*} Geospatial Consultant
{*} GIS Developer

Spatial technology for the masses, not the classes:
experience free and open source GIS at http://gvsigce.org

On Fri, Jan 9, 2015 at 9:35 AM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

On 08/01/15 23:46, Markus Metz wrote:

On Mon, Jan 5, 2015 at 12:17 PM, Benjamin Ducke <benducke@fastmail.fm>
wrote:

Thanks Markus, this is excellent progress.
It seems to me that the approximation of cluster shapes from grouped
points is a generic problem that would best be solved with a separate
module. As long as the shapes are roughly convex, the existing v.hull
should work fine. For concave shapes, AFAIK things become messy because
common methods such as alpha shapes require the user to provide
threshold values.

This is true, but v.concave.hull [0] could help :wink:

All these great addons !

For this particular one: would it be interesting / possible to integrate it
directly into v.hull ?

No, because v.hull is a C module and v.concave.hull a script which
does not use v.hull at all. Instead, v.concave.hull cleans the output
of v.delaunay to create concave hulls.

Markus M

On Fri, Jan 9, 2015 at 11:45 AM, Benjamin Ducke <benducke@fastmail.fm> wrote:

On 08/01/15 23:46, Markus Metz wrote:

[..]

Thanks Markus, this is excellent progress.
It seems to me that the approximation of cluster shapes from grouped
points is a generic problem that would best be solved with a separate
module. As long as the shapes are roughly convex, the existing v.hull
should work fine. For concave shapes, AFAIK things become messy because
common methods such as alpha shapes require the user to provide
threshold values.

This is true, but v.concave.hull [0] could help :wink:

Markus M

[0] https://trac.osgeo.org/grass/browser/grass-addons/grass7/vector/v.concave.hull

Wow. And it's been there for a while. How could I not see that?
I think it's high time that I switch from GRASS 6 to 7.

Indeed.

Nevertheless, since you did all that work on v.cluster in GRASS 6,
maybe it would be worth implementing this:

v.cluster exists only in GRASS 7.1. It can not even be backported ti
GRASS 7.0 because it relies on a new (new to GRASS) spatial index that
is only available in GRASS 7.1.

http://grasswiki.osgeo.org/wiki/Create_concave_hull

... in a GRASS 6 shell script?

If you know Python and shell scripting, translating v.concave.hull to
a shell script is easy. Otherwise, chances are good that the Python
script v.concave.hull also runs with GRASS 6. Maybe some option names
need to be modified.

Markus M

I am looking forward to trying the new clustering algorithms,
especially "density" and "optics2"

Many thanks,

Ben

--
Dr. Benjamin Ducke
{*} Geospatial Consultant
{*} GIS Developer

Spatial technology for the masses, not the classes:
experience free and open source GIS at http://gvsigce.org
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On Sun, Jan 11, 2015 at 9:03 PM, Markus Metz
<markus.metz.giswork@gmail.com> wrote:

On Fri, Jan 9, 2015 at 9:35 AM, Moritz Lennert wrote:

On 08/01/15 23:46, Markus Metz wrote:

On Mon, Jan 5, 2015 at 12:17 PM, Benjamin Ducke wrote:

Thanks Markus, this is excellent progress.
It seems to me that the approximation of cluster shapes from grouped
points is a generic problem that would best be solved with a separate
module. As long as the shapes are roughly convex, the existing v.hull
should work fine. For concave shapes, AFAIK things become messy because
common methods such as alpha shapes require the user to provide
threshold values.

This is true, but v.concave.hull [0] could help :wink:

All these great addons !

For this particular one: would it be interesting / possible to integrate it
directly into v.hull ?

No, because v.hull is a C module and v.concave.hull a script which
does not use v.hull at all. Instead, v.concave.hull cleans the output
of v.delaunay to create concave hulls.

I have a similar problem: imagine a set of contour lines which
describe the bathymetry of a lake, so essentially contour lines which
are closing a polygon but consist of different lines.

I would like to get the respective polygon representation, i.e. the
outer lines only and those turned into a polygon.

I just tried v.concave.hull on it, however, it expects points and not lines.
Does anyone have an idea how to achieve that?

thanks
markusN

Hei Markus,

Not sure I fully understood you problem...

I guess you don`t have a "grouping variable" (e.g. a lake ID) for the contour lines? If you had one, you could probably extract the outer lines based on the attribute table (get max depth by lake (or min depth, depending on how it is coded), something like where="depth=max_depth") and turn them into polygon (if lines are properly closed).

Otherwise, if contour lines are not grouped by lake, personally I might have probably used PostGIS like this:
1) Polygonize all contour lines (ST_MakePolygon), eventually after checking if line strings are properly closed (ST_IsClosed)
2) SELECT all intersecting combinations of polygons in the resulting table (ST_Intersects)
3) LEFT JOIN polygonised contour lines with themselves using ST_CoveredBy
4) SELECT only those where left join IS NULL

Is that somehow in the direction you were thinking?

Cheers
Stefan

________________________________________
Von: grass-dev-bounces@lists.osgeo.org <grass-dev-bounces@lists.osgeo.org> im Auftrag von Markus Neteler <neteler@osgeo.org>

I have a similar problem: imagine a set of contour lines which
describe the bathymetry of a lake, so essentially contour lines which
are closing a polygon but consist of different lines.

I would like to get the respective polygon representation, i.e. the
outer lines only and those turned into a polygon.

I just tried v.concave.hull on it, however, it expects points and not lines.
Does anyone have an idea how to achieve that?

thanks
markusN

On 22/03/15 21:37, Markus Neteler wrote:

On Sun, Jan 11, 2015 at 9:03 PM, Markus Metz
<markus.metz.giswork@gmail.com> wrote:

On Fri, Jan 9, 2015 at 9:35 AM, Moritz Lennert wrote:

On 08/01/15 23:46, Markus Metz wrote:

On Mon, Jan 5, 2015 at 12:17 PM, Benjamin Ducke wrote:

Thanks Markus, this is excellent progress.
It seems to me that the approximation of cluster shapes from grouped
points is a generic problem that would best be solved with a separate
module. As long as the shapes are roughly convex, the existing v.hull
should work fine. For concave shapes, AFAIK things become messy because
common methods such as alpha shapes require the user to provide
threshold values.

This is true, but v.concave.hull [0] could help :wink:

All these great addons !

For this particular one: would it be interesting / possible to integrate it
directly into v.hull ?

No, because v.hull is a C module and v.concave.hull a script which
does not use v.hull at all. Instead, v.concave.hull cleans the output
of v.delaunay to create concave hulls.

I have a similar problem: imagine a set of contour lines which
describe the bathymetry of a lake, so essentially contour lines which
are closing a polygon but consist of different lines.

I'm not sure I completely understand the situation, maybe an image would help.

I would like to get the respective polygon representation, i.e. the
outer lines only and those turned into a polygon.

I just tried v.concave.hull on it, however, it expects points and not lines.
Does anyone have an idea how to achieve that?

I take it that there are no attributes (e.g. depth) linked to the lines ?

Otherwise, maybe v.to.points + v.concave.hull + v.select ?

Or, manually, using the new "Select vector feature(s)" tool in the Map Display ?

Moritz

Hi,

ok, to make it hopefully clear:
attached a screenshot of the lines describing contours of a lake.

I would like to turn this into a polygon describing the like, ideally
in a non-manual way.

thanks
Markus

(attachments)

line_collection_to_become_outer_polygon.jpg

Hei Markus,

Assuming you have no attributes for those lines, what about the following procedure:

1) Turning all to closed line strings into areas in a first step (v.centroids) and then
2) use some v.to.db ("sides" option) in order to distinguish inner and outer boundaries, in other words those which have no category at one side from those which have a category at both sides?
3) Then you can extract the latter and build areas only from them...

Cheers
Stefan

-----Original Message-----
From: grass-dev-bounces@lists.osgeo.org [mailto:grass-dev-bounces@lists.osgeo.org] On Behalf Of Markus Neteler
Sent: 23. mars 2015 12:17
To: Moritz Lennert
Cc: GRASS developers list; Markus Metz
Subject: Re: [GRASS-dev] integrate v.concave.hull into v.hull [was point cloud analysis: new features]]

Hi,

ok, to make it hopefully clear:
attached a screenshot of the lines describing contours of a lake.

I would like to turn this into a polygon describing the like, ideally in a non-manual way.

thanks
Markus