Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?
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 andrea.a...@geo-solutions.it wrote: On Thu, May 7, 2015 at 3:26 PM, Sandro Santilli s...@keybit.net 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_Functions_Index.html#PostGIS_Curved_GeometryFunctions I don't think any of them supports linear but curve-accepting types. Right, this is the case that I'm after, I want to isolate geometries that will not be accepted by these functions. ST_HasArc almost does it, I want a function that does it fully Cheers Andrea -- == GeoServer Professional Services from the experts! Visit http://goo.gl/NWWaa2 for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it *AVVERTENZE AI SENSI DEL D.Lgs. 196/2003* Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003. The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc. --- -- == GeoServer Professional Services from the experts! Visit http://goo.gl/NWWaa2 for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it *AVVERTENZE AI SENSI DEL D.Lgs. 196/2003* Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003. The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were
Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?
On Thu, May 07, 2015 at 03:23:12PM +0200, Andrea Aime wrote: On Thu, May 7, 2015 at 3:21 PM, Sandro Santilli s...@keybit.net 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/feature request? It would be a feature request. Cool. How would you word it? I guess what we want here, to write generic sql queries, is a function that will tell us if the linear geometry functions can process a certain geometry. ST_IsLinearSafe(geom)? I meant it is a feature request to have ST_Simplify support curve types. The list of functions supposedly supporting cuve types are here: http://postgis.net/docs/PostGIS_Special_Functions_Index.html#PostGIS_Curved_GeometryFunctions I don't think any of them supports linear but curve-accepting types. --strk; ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?
On Thu, May 07, 2015 at 12:14:29PM +0200, Andrea Aime wrote: On Tue, May 5, 2015 at 6:33 PM, Andrea Aime andrea.a...@geo-solutions.it wrote: On Tue, May 5, 2015 at 6:31 PM, Paul Ramsey pram...@cleverelephant.ca 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 check the geometry type and refuses to work on it. Shall I open a bug report/feature request? It would be a feature request. --strk; ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?
On Thu, May 7, 2015 at 3:21 PM, Sandro Santilli s...@keybit.net 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/feature request? It would be a feature request. Cool. How would you word it? I guess what we want here, to write generic sql queries, is a function that will tell us if the linear geometry functions can process a certain geometry. ST_IsLinearSafe(geom)? Cheers Andrea -- == GeoServer Professional Services from the experts! Visit http://goo.gl/NWWaa2 for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it *AVVERTENZE AI SENSI DEL D.Lgs. 196/2003* Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003. The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc. --- ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?
On Thu, May 7, 2015 at 3:26 PM, Sandro Santilli s...@keybit.net 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_Functions_Index.html#PostGIS_Curved_GeometryFunctions I don't think any of them supports linear but curve-accepting types. Right, this is the case that I'm after, I want to isolate geometries that will not be accepted by these functions. ST_HasArc almost does it, I want a function that does it fully Cheers Andrea -- == GeoServer Professional Services from the experts! Visit http://goo.gl/NWWaa2 for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it *AVVERTENZE AI SENSI DEL D.Lgs. 196/2003* Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003. The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc. --- ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?
On Tue, May 5, 2015 at 6:33 PM, Andrea Aime andrea.a...@geo-solutions.it wrote: On Tue, May 5, 2015 at 6:31 PM, Paul Ramsey pram...@cleverelephant.ca 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 check the geometry type and refuses to work on it. Shall I open a bug report/feature request? Here is an example: MULTISURFACE(CURVEPOLYGON(COMPOUNDCURVE((25496651.4916 6674112.9568,25496652.9600555 6674113.15828079,25496654.4404797 6674113.23108252,25496655.9216183 6674113.17465174,25496657.3922115 6674112.98941744,25496658.8410796 6674112.6767878,25496660.2572081 6674112.23913946,25496661.6298314 6674111.67979949,25496662.9485147 6674111.00302006,25496664.2032332 6674110.21394615,25496665.3844482 6674109.3185764,2549.4831801 6674108.32371753,25496667.4910762 6674107.23693258,25496668.4004743 6674106.06648345,25496669.204461 6674104.82126804,25496669.8969243 6674103.51075266,25496670.4726 6674102.1449),(25496670.4726 6674102.1449,25496678.3273 6674080.9744),(25496678.3273 6674080.9744,25496709.2227 6673929.1767),(25496709.2227 6673929.1767,25496710.0592419 6673925.62354064,25496711.1103048 6673922.12782752,25496712.372 6673918.7025),(25496712.372 6673918.7025,25496714.6042041 6673913.81144642,25496717.2652786 6673909.13984902,25496720.3338569 6673904.72521794,25496723.7853 6673900.603),(25496723.7853 6673900.603,25496744.2090639 6673879.38909363,25496765.6490722 6673859.20281227,25496788.0537 6673840.0928),(25496788.0537 6673840.0928,25496801.2714 6673854.9981),(25496801.2714 6673854.9981,25496827.0266 6673832.1946),(25496827.0266 6673832.1946,25496812.5045 6673815.2716),(25496812.5045 6673815.2716,25496818.5563 6673810.0894),(25496818.5563 6673810.0894,25496854.2557 6673779.5197),(25496854.2557 6673779.5197,25496887.545 6673751.0139),(25496887.545 6673751.0139,25496890.8911 6673748.1485),(25496890.8911 6673748.1485,25496897.0822 6673743.927),(25496897.0822 6673743.927,25496902.7355681 6673740.73662356,25496908.6383069 6673738.03537638,25496914.7482 6673735.8426),(25496914.7482 6673735.8426,25496950.4171 6673727.3498),(25496950.4171 6673727.3498,25496957.9619 6673725.5533),(25496957.9619 6673725.5533,25496986.2922 6673718.5715),(25496986.2922 6673718.5715,25497010.1611 6673712.7616),(25497010.1611 6673712.7616,25497041.7216 6673705.0793),(25497041.7216 6673705.0793,25497064.5242 6673699.4726),(25497064.5242 6673699.4726,25497088.3888 6673693.6046),(25497088.3888 6673693.6046,25497096.8207 6673691.6638),(25497096.8207 6673691.6638,25497122.6558 6673690.4262),(25497122.6558 6673690.4262,25497197.1328 6673692.7781),(25497197.1328 6673692.7781,25497204.4504 6673693.0092),(25497204.4504 6673693.0092,25497224.5568 6673694.0241),(25497224.5568 6673694.0241,25497250.7102 6673695.6603),(25497250.7102 6673695.6603,25497251.0164 6673689.6954),(25497251.0164 6673689.6954,25497253.0175 6673650.7191),(25497253.0175 6673650.7191,25497256.551 6673583.7225),(25497256.551 6673583.7225,25497303.9707 6673586.4735),(25497303.9707 6673586.4735,25497301.7817 6673627.9866),(25497301.7817 6673627.9866,25497307.8107 6673628.341),(25497307.8107 6673628.341,25497331.554 6673643.0608),(25497331.554 6673643.0608,25497331.7805916 6673643.18801735,25497332.0173427 6673643.29514789,25497332.2624767 6673643.38138779,25497332.5141543 6673643.44608993,25497332.7704872 6673643.48876884,25497333.0295518 6673643.50910427,25497333.2894043 6673643.50694364,25497333.548095 6673643.48230316,25497333.8036827 6673643.43536771,25497334.0542497 6673643.36648948,25497334.2979157 6673643.27618529,25497334.5328526 6673643.16513274,25497334.7572975 6673643.0341651,25497334.9695662 6673642.88426508,25497335.1680659 6673642.71655745,25497335.3513074 6673642.53230061,25497335.5179155 6673642.3328771,25497335.403 6673642.11978331,25497335.7963656 6673641.89461816,25497335.9061182 6673641.65907119,25497335.9950745 6673641.41490979,25497336.0625671 6673641.16396604,25497336.1080894 6673640.90812287,25497336.1313 6673640.6493),(25497336.1313 6673640.6493,25497336.5634 6673631.288),(25497336.5634 6673631.288,25497349.9056 6673638.9515),(25497349.9056 6673638.9515,25497336.9526 6673659.042),(25497336.9526 6673659.042,25497419.119 6673710.0456),(25497419.119 6673710.0456,25497404.5574 6673733.505),(25497404.5574 6673733.505,25497407.291473 6673735.03585433,25497410.1522649 6673736.31434549,25497413.116541 6673737.33008987,25497416.1602264 6673738.07483784,25497419.2586008 6673738.54254074,25497422.3865 6673738.7294),(25497422.3865 6673738.7294,25497437.0015353 6673738.22980162,25497451.498467 6673736.30942999,25497465.7395071 6673732.98653517,25497479.5893 6673728.2927),(25497479.5893 6673728.2927,25497492.0231 6673714.1359),(25497492.0231 6673714.1359,25497496.498 6673717.6458),(25497496.498 6673717.6458,25497489.4617 6673726.2259),(25497489.4617 6673726.2259,25497497.9243436 6673724.39763888,25497506.5235036
Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?
ST_HasArc() should do what you want On Tue, May 5, 2015 at 1:52 AM, Andrea Aime andrea.a...@geo-solutions.it 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 optimize data transfer and overall performance when doing map rendering, we just get the geometries as complex as we need them to. However, I've found out that the function does not support curved geometries, all will throw an error if it encounters one of them, e.g.: select st_simplify(geometry, 0.1) from curves; ERROR: lwgeom_simplify: unsupported geometry type: CircularString Curved geometries are often representing a small percentage of the geometries, so I would like to keep on simplifying the geometries made of straight segments, while skipping simplification on the curved ones, so I'm looking for a way to quickly and unobstrusively check if geometry has curved portions inside of it. So far I've come up with this, but it's not simple, unobstrusive, probably not so fast due to string comparisons, and not general (what if I stumble into a geometry collection that does contain curve elements for example?): select case geometrytype(geometry) when 'CIRCULARSTRING' then geometry when 'COMPOUNDCURVE' then geometry when 'CURVEPOLYGON' then geometry when 'MULTISURFACE' then geometry when 'MULTICURVE' then geometry else st_simplify(geometry,0.1) end from curves; Can anybody suggest a better way, that would not require us to have the end user tell us if a table mixes in curve bits, or not? Cheers Andrea -- == GeoServer Professional Services from the experts! Visit http://goo.gl/NWWaa2 for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it AVVERTENZE AI SENSI DEL D.Lgs. 196/2003 Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003. The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc. --- ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?
On Tue, May 5, 2015 at 6:31 PM, Paul Ramsey pram...@cleverelephant.ca 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 the experts! Visit http://goo.gl/NWWaa2 for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it *AVVERTENZE AI SENSI DEL D.Lgs. 196/2003* Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003. The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc. --- ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?
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. Nicolas On 5 May 2015 at 10:52, Andrea Aime andrea.a...@geo-solutions.it 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 optimize data transfer and overall performance when doing map rendering, we just get the geometries as complex as we need them to. However, I've found out that the function does not support curved geometries, all will throw an error if it encounters one of them, e.g.: select st_simplify(geometry, 0.1) from curves; ERROR: lwgeom_simplify: unsupported geometry type: CircularString Curved geometries are often representing a small percentage of the geometries, so I would like to keep on simplifying the geometries made of straight segments, while skipping simplification on the curved ones, so I'm looking for a way to quickly and unobstrusively check if geometry has curved portions inside of it. So far I've come up with this, but it's not simple, unobstrusive, probably not so fast due to string comparisons, and not general (what if I stumble into a geometry collection that does contain curve elements for example?): select case geometrytype(geometry) when 'CIRCULARSTRING' then geometry when 'COMPOUNDCURVE' then geometry when 'CURVEPOLYGON' then geometry when 'MULTISURFACE' then geometry when 'MULTICURVE' then geometry else st_simplify(geometry,0.1) end from curves; Can anybody suggest a better way, that would not require us to have the end user tell us if a table mixes in curve bits, or not? Cheers Andrea -- == GeoServer Professional Services from the experts! Visit http://goo.gl/NWWaa2 for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it *AVVERTENZE AI SENSI DEL D.Lgs. 196/2003* Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003. The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc. --- ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?
On Tue, May 5, 2015 at 11:35 AM, Nicolas Ribot nicolas.ri...@gmail.com 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_simplify and call it from your SQL code, according to your needs. Yep, that's an idea... however it requires some level of admin rights on the database, which the applications based on GeoTools (uDig, GeoServer) do not normally get. It is possible to catch errors inline in a select statement? Cheers Andrea -- == GeoServer Professional Services from the experts! Visit http://goo.gl/NWWaa2 for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it *AVVERTENZE AI SENSI DEL D.Lgs. 196/2003* Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003. The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc. --- ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
Re: [postgis-users] Quick/unobstrusive way to determine if a geometry has curve elements?
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 andrea.a...@geo-solutions.it: On Tue, May 5, 2015 at 11:35 AM, Nicolas Ribot nicolas.ri...@gmail.com 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_simplify and call it from your SQL code, according to your needs. Yep, that's an idea... however it requires some level of admin rights on the database, which the applications based on GeoTools (uDig, GeoServer) do not normally get. It is possible to catch errors inline in a select statement? Cheers Andrea -- == GeoServer Professional Services from the experts! Visit http://goo.gl/NWWaa2 for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it *AVVERTENZE AI SENSI DEL D.Lgs. 196/2003* Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003. The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc. --- ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users