[postgis-users] voronoi fails on regular grid
J.J. Green
j.j.green at gmx.co.uk
Sat Feb 24 02:20:50 PST 2018
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/
More information about the postgis-users
mailing list