Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?

2015-05-05 Thread Nicolas Ribot
Hi Andrea, You could use a PLPGSQL function to catch error for curved geometries and return the geometry itself in case of error. Then, either you put all your generic code in this function, or you just write a wrapper around st_simplify and call it from your SQL code, according to your needs. N

Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?

2015-05-05 Thread Andrea Aime
On Tue, May 5, 2015 at 11:35 AM, Nicolas Ribot wrote: > Hi Andrea, > > You could use a PLPGSQL function to catch error for curved geometries and > return the geometry itself in case of error. > > Then, either you put all your generic code in this function, or you just > write a wrapper around st_

Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?

2015-05-05 Thread Rémi Cura
Putting an exception block will slow down your function. You can put an exception in any plpgsql function. So you only need the right to create a plpgsql function. Cheers, Rémi-C 2015-05-05 11:45 GMT+02:00 Andrea Aime : > On Tue, May 5, 2015 at 11:35 AM, Nicolas Ribot > wrote: > >> Hi Andrea,

Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?

2015-05-05 Thread Paul Ramsey
ST_HasArc() should do what you want On Tue, May 5, 2015 at 1:52 AM, Andrea Aime wrote: > Hi, > I have some generic build of code that are building queries to postgis > includingthe st_simplify function, e.g: > > select st_simplify(geometry, tolerance) from mytable where ... > > This is done to op

Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?

2015-05-05 Thread Andrea Aime
On Tue, May 5, 2015 at 6:31 PM, Paul Ramsey wrote: > ST_HasArc() should do what you want > Ah ha, looks like exactly what I wantedI did search for all function names containing curves, it did not occur to me to search for arc :-) Cheers Andrea -- == GeoServer Professional Services from th

Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?

2015-05-07 Thread Andrea Aime
On Tue, May 5, 2015 at 6:33 PM, Andrea Aime wrote: > On Tue, May 5, 2015 at 6:31 PM, Paul Ramsey > wrote: > >> ST_HasArc() should do what you want >> > > Looks like there is still a wrinkle... one can build compoudcurve without any arc in it, ST_HasArc will return false, but ST_Simplify only che

Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?

2015-05-07 Thread Sandro Santilli
On Thu, May 07, 2015 at 12:14:29PM +0200, Andrea Aime wrote: > On Tue, May 5, 2015 at 6:33 PM, Andrea Aime > wrote: > > > On Tue, May 5, 2015 at 6:31 PM, Paul Ramsey > > wrote: > > > >> ST_HasArc() should do what you want > >> > > > > > Looks like there is still a wrinkle... one can build compou

Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?

2015-05-07 Thread Andrea Aime
On Thu, May 7, 2015 at 3:21 PM, Sandro Santilli wrote: > > Looks like there is still a wrinkle... one can build compoudcurve without > > any arc in it, ST_HasArc will > > return false, but ST_Simplify only check the geometry type and refuses to > > work on it. > > Shall I open a bug report/featur

Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?

2015-05-07 Thread Sandro Santilli
On Thu, May 07, 2015 at 03:23:12PM +0200, Andrea Aime wrote: > On Thu, May 7, 2015 at 3:21 PM, Sandro Santilli wrote: > > > > Looks like there is still a wrinkle... one can build compoudcurve without > > > any arc in it, ST_HasArc will > > > return false, but ST_Simplify only check the geometry t

Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?

2015-05-07 Thread Andrea Aime
On Thu, May 7, 2015 at 3:26 PM, Sandro Santilli wrote: > I meant it is a feature request to have ST_Simplify support curve types. > Ah, but I'm not really interested in this one. > The list of functions supposedly supporting cuve types are here: > > http://postgis.net/docs/PostGIS_Special_Func

Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?

2015-05-08 Thread Andrea Aime
Hi, just to be on the safe side, I've opened both: http://trac.osgeo.org/postgis/ticket/3112 http://trac.osgeo.org/postgis/ticket/3113 Cheers Andrea On Thu, May 7, 2015 at 3:34 PM, Andrea Aime wrote: > On Thu, May 7, 2015 at 3:26 PM, Sandro Santilli wrote: > >> I meant it is a feature request