[postgis-users] Voronoi tessellation

Puneet Kishor punk.kish at gmail.com
Tue Mar 6 07:15:31 PST 2012


On Mar 6, 2012, at 9:08 AM, Ben Madin wrote:

> Hi Puneet,
> 
> Did it work when you removed the offending semicolon, as described in the syntax error message?


Ben, 

To be honest, I didn't try that approach. I am in a hurry for a presentation this aft, so I wanted to get this rolling, and will try that later.

That said, I am not sure if that semicolon is the offender. Assuming the error trace is identifying the correct line, the offending line is (I have cleaned it up to reflect modern usage, Pg 9, PostGIS 1.5.x, etc.)

	points <- pg.spi.exec(sprintf("SELECT ST_X(%2$s) AS x, ST_Y(%2$s) AS y FROM %1$s;",arg1,arg2))

The semicolon, afaict, is required to construct the correct SQL statement. For now, I hard coded the statement like so, and it works

	points <- pg.spi.exec("SELECT ST_X(the_geom) AS x, ST_Y(the_geom) AS y FROM mytable;")


> 
> cheers
> 
> Ben
> 
> 
> 
> On 06/03/2012, at 11:52 AM, Puneet Kishor wrote:
> 
>> 
>> On Mar 5, 2012, at 9:44 PM, Derek Jones wrote:
>> 
>>> Hi all,
>>> 
>>> I have used an R solution that works well with the plsql to do this. Found here:
>>> 
>>> http://www.bostongis.com/PrinterFriendly.aspx?content_name=postgresql_plr_tut02
>>> 
>>> Needed some mods for my local solution, but helpful.
>>> 
>> 
>> 
>> Yes, I tried that, but as I noted in my earlier email, I got the following error
>> 
>> ERROR:  R interpreter expression evaluation error
>> DETAIL:  Error in pg.spi.exec(sprintf("select x(%2$s) as x, y(%2$s) as y from %1$s;",  : 
>> error in SQL statement : syntax error at or near ";"
>> CONTEXT:  In R support function pg.spi.exec
>> In PL/R function voronoi
>> 
>> 




More information about the postgis-users mailing list