[postgis-users] Efficient Way To Get Voronoi Polygons and Matched Points

Gerard LYNCH gerard.lynch at ericsson.com
Wed Mar 1 19:26:18 PST 2017


Hello,

I'm using postgis2.3 and ST_VoronoiPolygons.

I would like to know the best way to do a reverse lookup of sorts to find out which Voronoi polygon maps to which point(s) used in ST_Collect.

Currently I'm looping through each of the input points and doing a ST_Within on each of the Voronoi polygons until I get a match. This can be time consuming when there are 1000 points and 1000 voronoi polygons. I could also do the reverse and loop through each of the Voronoi polygons and fetch points within the polygon but I am wondering if there is a more efficient approach.

Ideally an object that returned something like "Polygon1 => [pointa, pointb], Polygon2 => [pointc]" etc would be preferable.

My use case is when someone clicks on a Voronoi polygon in my GUI I would like to be able to provide the user with information on the points used to create that polygon.

Cheers,
Gerard


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20170302/f94a3f13/attachment.html>


More information about the postgis-users mailing list