[postgis-users] voronoi fails on regular grid

Darafei "Komяpa" Praliaskouski me at komzpa.net
Sat Feb 24 07:53:56 PST 2018


Hi,

Please post your points to https://trac.osgeo.org/geos/ as a bug report.

In my experience two things help with Voronoi issues:
 - ST_SnapToGrid;
 - falling back to non-geos voronoi implementation,
https://github.com/wgnet/globalmap/blob/master/code/postgis_wrappers/ST_VoronoiPolygons.sql,
sometimes heals issues (by the price of super slow processing).

сб, 24 февр. 2018 г. в 13:20, J.J. Green <j.j.green at gmx.co.uk>:

> Hi all,
>
> I have some point data in latlong which I project onto
> some SRID, then perform the following query:
>
>    CREATE TEMPORARY TABLE cell_poly_tmp ON COMMIT DROP AS
>      SELECT
>        Geometry(
>          (
>            ST_Dump(
>              ST_CollectionExtract(
>                ST_VoronoiPolygons(
>                  ST_Collect(point),
>                  0.0
>                ),
>                3
>              )
>            )
>          ).geom
>        ) AS poly
>      FROM cell_point_tmp;
>
> For most SRIDs this works OK, but for 3857, I get
>
>    56966976: ERROR:  GEOSVoronoiDiagram: TopologyException:
>    Input geom 1 is invalid: Self-intersection at or near point
>    444332.38647522771 8548816.0569835864 at
>    444332.38647522771 8548816.0569835864
>
> Now this is a bit of a pain, since 3857 is SRID I want to use --
> the target is an OpenLayers application and their 3857 tiles.
>
> I observe that the (projected) points in this case are on a
> uniform grid (clearly the source used a uniform grid in 3875
> and transformed to latlong), and that the failed point is at
> the dead-centre of one of the grid-cells at the edge of the
> domain.
>
> A plot of the geometry and the input data point are at
>
>    https://gist.github.com/jjgreen/b0846716cfe076ae194217d1585783bb
>
> I've tried sliding ST_MakeValid() in various places in the query,
> but without success.
>
> Any thoughts as to how to proceed?
>
> My setup is Ubuntu Xenial with PostGIS from apt-postgresql.org,
> and
>
>    POSTGIS="2.3.3 r15473"
>    GEOS="3.5.0-CAPI-1.9.0 r4084"
>    PROJ="Rel. 4.9.2, 08 September 2015"
>    GDAL="GDAL 1.11.3, released 2015/09/16"
>    LIBXML="2.9.3"
>    LIBJSON="0.11.99" RASTER
>
> Cheers
>
> Jim
> --
> J.J. Green
> http://soliton.vm.bytemark.co.uk/pub/jjg/en/
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20180224/63b376cf/attachment.html>


More information about the postgis-users mailing list