[postgis-users] ST_ConcaveHull giving up too soon, aka too convex

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Tue Jan 14 07:34:26 PST 2014


Try this:

SELECT ST_Buffer(ST_Union(ST_Buffer(geom, 0.0001)), -0.00008) FROM points

> -----Original Message-----
> From: postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-
> bounces at lists.osgeo.org] On Behalf Of Ivan Price
> Sent: Tuesday, January 14, 2014 8:36 AM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] ST_ConcaveHull giving up too soon, aka too
> convex
> 
> Thanks for your reply Remi,
> 
> 
> 
> for now we are going with simply a union of a buffer of the points (as you
> suggested) as it makes sense in the context of the origin of the data
> anyway.
> 
> 
> 
> cheers
> 
> 
> 
> -i
> 
> 
> 
> 
> 
> De : postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-
> bounces at lists.osgeo.org] De la part de Rémi Cura
> Envoyé : Tuesday, 14 January 2014 11:39
> À : PostGIS Users Discussion
> Objet : Re: [postgis-users] ST_ConcaveHull giving up too soon, aka too
> convex
> 
> 
> 
> Hey,
> 
> sadly I can't answer your questions,
> 
> but it looks like you don't want concave hull but instead Alpha Shape (see
> SFCGAL , maybe they have integrated it).
> 
> 
> You have still a lot of workaround :
> if you don't mind expending the bouyndary, a union of buffers of points
> if you don't mind quantization (anyway your input looks quantized) :
> convert to raster, then any classical image processing easily available
> (watershed for example) (you can use out of the box QGIS 2.0 raster
> processing tools)
> if you want a sharp boudary : and assuming your points are regularly
> spaced : maybe something liek this (untested)
> create a segment for each point to his K nearest neighbours (K would be 2
> or 3, and you would put a max distance before drawing a line)
> 
> Then pick the segments that have no  intersection with other segments, and
> either use ST_Polygonyze, or cut the bounding box polygon with the
> segments and remove the part outside
> .
> 
> Maybe you can try to reduce your point precision for processing (snap to
> grid) and/or put the points in an appropriate srid (not too much digits)
> 
> 
> 
> Cheers,
> 
> Rémi-C
> 
> 
> 
> 2014/1/14 Ivan Price <Ivan.Price at noveltis.fr>
> 
> 
> 
> Hi there,
> 
> 
> 
> I am experimenting with ST_ConcaveHull, am using Postgres 9.2.2 on
> windows with postgis 2.1.1 r12113
> 
> 
> 
> i have a table of 218 points forming roughly an arc (something like the nike
> swoosh)
> 
> 
> 
> when i ask for the concave hull i'm expecting a poly shrink-wrapped to
> them, however this is not the case, even when i set a very low percentage
> area parameter. for example:
> 
> 
> 
> SELECT ST_ConcaveHull(ST_Collect(geom), 0.000001) as geom FROM
> points;
> 
> 
> 
> i attach a screenshot of the points and the convext hull, as well as an sql
> dump of the points themselves.
> 
> 
> 
> also as a side note, in researching the problem i upgraded from postgis 2.01
> to 2.1.1 and noticed a change in the processing time for the above
> statement from 1 minute to ~ 5 minutes.
> 
> 
> 
> are there any pointers for making ConcaveHull more 'aggressive' ?
> 
> 
> 
> thanks and regards
> 
> 
> 
> -i
> 
> 
> 
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
> 
> 



More information about the postgis-users mailing list