[postgis-users] A function for using PL/R with deldir to produce voronoi polygons in PostGIS

Mike Leahy mgleahy at alumni.uwaterloo.ca
Tue Jun 19 13:27:45 PDT 2007


All,

Attached is a PL/R-based function that I put together based on Jan
Hartmann's help in the PotGIS list about a year ago for generating
voronoi polygons using the deldir library.  Now that I've started with
PL/R, I was able capture this in a single function that will take in the
points from a table or query, produce the voronoi polygons, and return a
list of the polygon geometries along with the id's of their originating
points.

I'm not sure if the approach I used in this example is ideal; it hasn't
been tested on large datasets yet, and I'm sure someone can probably
find a different way to do this (there is also the tripack library in R,
which I haven't tried yet). However, it seems to work fine from what I
can tell.  I just thought this might serve as an example of how PL/R can
be handy alongside PostGIS.

Regards,
Mike

P.S.: I did notice the same problem as Regina - once I started trying to
execute this script directly from the text file, I had to make sure it
was in UNIX format for PL/R to parse it properly...even though
everything I'm doing is on Windows at the moment.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: voronoi_plr-deldir.sql
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070619/1e5cd395/attachment.ksh>


More information about the postgis-users mailing list