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

Ivan Price Ivan.Price at noveltis.fr
Tue Jan 14 08:25:28 PST 2014


Thanks again Remi and Pierre

indeed with the following query:

SELECT ST_Transform(
           ST_Buffer (
                ST_Union(
                    ST_Buffer(
                        ST_Transform(geom, 27572),
                        4
                    )
                ),
                -3.0
            ),
            4326
        )
as geom FROM points

we get something more like what we were expecting. we experimented with the endcap but the speed / complexity of features is not really a prob for our application. we have the transforms in there to allow the data to stay in degrees but the shrinkedness of the query to be parameterised in metres. (e.g. +4, -3)

cheers and bonsoir,

-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 16:51
À : PostGIS Users Discussion
Objet : Re: [postgis-users] ST_ConcaveHull giving up too soon, aka too convex

Hope it works =)

Don't forget to use text paramter of buffers to reduce the number of segpoints (faster, more coherent with your data)
Try either 'endcap=square'
or quadseg = 1 (I can't test here)
Cheers,

Rémi-C

2014/1/14 Pierre Racine <Pierre.Racine at sbf.ulaval.ca<mailto:Pierre.Racine at sbf.ulaval.ca>>
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> [mailto:postgis-users-<mailto:postgis-users->
> bounces at lists.osgeo.org<mailto: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> [mailto:postgis-users-<mailto:postgis-users->
> bounces at lists.osgeo.org<mailto: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<mailto: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<mailto:postgis-users at lists.osgeo.org>
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
>

_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org<mailto:postgis-users at lists.osgeo.org>
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20140114/a344aacf/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen.png
Type: image/png
Size: 23585 bytes
Desc: Screen.png
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20140114/a344aacf/attachment.png>


More information about the postgis-users mailing list