[postgis-users] voronoi fails on regular grid

Darafei "Komяpa" Praliaskouski me at komzpa.net
Mon Feb 26 12:20:20 PST 2018


It seems this was recently proposed by Dan Baston in his post:

http://www.danbaston.com/posts/2018/02/15/optimizing-postgis-geometries.html

How about we bitset the tail up to EPSILON_SQLMM on Voronoi failure and try
again?

J.J.Green, can you share your geometry as binary representation so we can
see if this workaround helps?

select ST_AsEWKB(ST_Collect(point)) from cell_point_tmp;

вс, 25 февр. 2018 г. в 19:04, J.J. Green <j.j.green at gmx.co.uk>:

> Hi Darafei,
>
> Many thanks for your reply
>
> > Please post your points to https://trac.osgeo.org/geos/ as a bug report.
>
> I'll do that
>
> > In my experience two things help with Voronoi issues:
> >   - ST_SnapToGrid;
> >   - falling back to non-geos voronoi implementation,
>
> In fact the first of those works beautifully -- I tried several
> values and found that dyadic fractions (as in 1/2^n) work best,
> this kind-of makes sense since it "zeros-out" the bottom-end of
> the floats, and then calculations with them should be exact
> (provided the input numbers are of the same order, and they are).
>
> For the sake of others happening across this issue, my
> working Voronoi call is now
>
>    CREATE TEMPORARY TABLE cell_poly_tmp ON COMMIT DROP AS
>      SELECT
>        Geometry(
>          (
>            ST_Dump(
>              ST_CollectionExtract(
>                ST_VoronoiPolygons(
>                  ST_SnapToGrid(
>                    ST_Collect(point),
>                    pow(2.0, -8)
>                  ),
>                  0.0
>                ),
>                3
>              )
>            )
>          ).geom
>        ) AS poly
>      FROM cell_point_tmp;
>
> Thanks again!
>
> 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/20180226/cb91da88/attachment.html>


More information about the postgis-users mailing list