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

Obe, Regina robe.dnd at cityofboston.gov
Tue Jun 19 13:45:27 PDT 2007


Cool.  It would be nice to put this in the postgis wiki along with other
utility functions.  Perhaps we can create a section of the wiki for PL/R
type functions since it's a bit off the mainstream, but I think still
very useful to people who use PostGIS.

Thanks,
Regina



-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Mike
Leahy
Sent: Tuesday, June 19, 2007 4:28 PM
To: plr-general at pgfoundry.org; postgis-users at postgis.refractions.net
Subject: [postgis-users] A function for using PL/R with deldir to
produce voronoi polygons in PostGIS

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.
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.



More information about the postgis-users mailing list