[postgis-devel] Specifying end cap and join styles Buffer op

Paragon Corporation lr at pcorp.us
Mon Jun 22 02:39:06 PDT 2009


Strk,
I was thinking that we check it at the SQL  level.

So we would have say 3 functions

_ST_Buffer --> geom,rad,params  C lang calls postgis function directly
ST_Buffer(geom,rad,params) -> SELECT _ST_Buffer(geom,rad, CASE WHEN params
~= '[0123456789]+' THEN 'quad_segments=' || params ELSE params END) ; (well
some regex thingy my syntax is probably wrong) 

--I suppose in theory we don't need this last one anymore to keep backward
compatibility as the integer would be cast to text and move to the other
(which is perhaps what Paul was thinking in too terse of a statement),
-- but I don't like relying on the implicit cast being there.

ST_Buffer(geom,rad, quad_segment) (takes integer  -- which becomes
short-hand for something like _ST_Buffer(geom,rad, 'quad_segments=' ||
CAST(quad_segment As text)) 

So in the end you have just one C function to rule them all

-----Original Message-----
From: postgis-devel-bounces at postgis.refractions.net
[mailto:postgis-devel-bounces at postgis.refractions.net] On Behalf Of strk
Sent: Monday, June 22, 2009 5:19 AM
To: PostGIS Development Discussion
Subject: Re: [postgis-devel] Specifying end cap and join styles Buffer op

On Sun, Jun 21, 2009 at 08:31:05PM -0400, Paragon Corporation wrote:
> 
> The more that I'm thinking about it, I'm actually okay with the
> 
> st_buffer(geom, rad, params)
> 
> To support the backward compatibility, we could just have the function 
> handle the special case when someone only passed in a number as a 
> string like '10'.  In the buffer function.  So that takes care of the 
> backward compatibility with people mis relying on autocasting.

PostGIS currently has no function checking the data type of arguments at the
C level, so there's no guarantee this will work seamlessly. An option could
be having two C functions, one taking the string, one taking the number. If
we go there though the one taking the string would end up looking like the
other in order to support pre-GEOS-3.2 functionality.

Or, Mark, have hints on how to check for sure data type of on arg in a sane
way ?

--strk;

 Free GIS & Flash consultant/developer      ()  ASCII Ribbon Campaign
 http://foo.keybit.net/~strk/services.html  /\  Keep it simple! 
_______________________________________________
postgis-devel mailing list
postgis-devel at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-devel






More information about the postgis-devel mailing list