3

I am trying to create a global voronoi diagram for three points (cities): Miami, Boston and Honolulu. The geom column contains the points created by x and y.:

| index |   name   |      x       |      y      | geom |
|-------|----------|--------------|-------------|------|
|     0 | Miami    | -80.25551469 | 25.79555801 | .... |
|     1 | Boston   | -71.07082218 |  42.3585578 | .... |
|     2 | Honolulu | -157.8555857 | 21.30573449 | .... |

To create a Voronoi diagram I tried:

CREATE TABLE voronoiv07 AS
SELECT name,
    ST_VoronoiPolygons(geom,0,ST_Polygon(ST_GeomFromText('LINESTRING(-180 -90, 180 -90, 180  90, -180 90, -180-90 )'), 4326)) As geom
FROM cities

The result is a table with invalid geometries. Any ideas how to easily create a global voronoi diagram (with polygons that cross the -180 degree meridian)?

  • 1
    I think you would have to use some kind of coordinate shift, eg, add 180 degrees to all the longitudes and use wraparound, ie, repeat the part of the earth near the dateline on the other side, run the Voronoi process, and then clip back to the actual area representing one earth in a similar vein to this answer. – John Powell Jun 27 '18 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.