Thanks for you answer Mark, but st_linetocurve in my test cases always add a segment at the end or at the start of the original curve. St_linetocurve behaviour in this way is not good for me because I need the same curves with the same original points ( millimeter differences can be accepted ).
Postgis functions curve geometry support is planed for development? Anyway thanks mario -----Original Message----- From: postgis-users-boun...@postgis.refractions.net [mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of Mark Cave-Ayland Sent: mercoledì, 29. luglio 2009 14:33 To: PostGIS Users Discussion Subject: Re: [postgis-users] postgis 1.4 and curves ma...@geosar.ch wrote: > Hi, > the geometry is : > GeomFromText('COMPOUNDCURVE((723702.522 121248.15,723892.918 > 121297.093),(723892.918 121297.093,724230.191 > 121220.96),CIRCULARSTRING(724230.191 121220.96,724268.27 > 121144.826,724251.951 121025.188))') > > Then try: > select st_astext( st_linetocurve( > st_curvetoline(GeomFromText('COMPOUNDCURVE((723702.522 121248.15,723892.918 > 121297.093),(723892.918 121297.093,724230.191 > 121220.96),CIRCULARSTRING(724230.191 121220.96,724268.27 > 121144.826,724251.951 121025.188))')) ) ) > > I obtain: > COMPOUNDCURVE((723702.522 121248.15,723892.918 121297.093,724230.191 > 121220.96),CIRCULARSTRING(724230.191 121220.96,724271.107624879 > 121128.220456049,724253.605225062 121028.378284577),(724253.605225062 > 121028.378284577,724251.951 121025.188)) > > After the arc another line is added and the points of the arc are different. > > Thanks > Mario Hi Mario, I don't think that this is actually a PostGIS bug. The reason for this is that the transformation from curve to line is lossy in that any CIRCULARSTRINGs are converted from smooth curves into a series of short linestring segments, and so when converting back from line to curve, the curve fitting algorithm has no knowledge of the makeup of the original geometry. So as it traverses the input line segments, it will generate CIRCULARSTRINGs for lines that appear to fit around a given radius, regardless of whether they were originally mapped as LINESTRINGs or CIRCULARSTRINGs. Note that you can test yourself to see that your original input geometry and the output geometry are equivalent by comparing the results of the conversion from curves back to lines: postgis14=# select st_astext(st_curvetoline(geomfromtext('COMPOUNDCURVE((723702.522 121248.15,723892.918 121297.093,724230.191 121220.96),CIRCULARSTRING(724230.191 121220.96,724271.107624879 121128.220456049,724253.605225062 121028.378284577),(724253.605225062 121028.378284577,724251.951 121025.188))'))); st_astext ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ----------------------------------------------------------------------- LINESTRING(723702.522 121248.15,723892.918 121297.093,724230.191 121220.96,724235.615995416 121214.326233812,724240.708952709 121207.434266378,724245.457602499 121200.300701051,724249.850504871 121192.942723214,724253.87707694 121185.378058881,724257.527618341 121177.62493199,724260.793334599 121169.702020504,724263.666358319 121161.62841141,724266.139768134 121153.423554739,724268.207605384 121145.10721671,724269.864888467 121136.69943211,724271.107624843 121128.220456028,724271.932820652 121119.69071506,724272.338487925 121111.1307581,724272.323649373 121102.561206832,724271.888340744 121094.002706058,724271.033610735 121085.475873955,724269.761518465 121077.001252409,724268.075128515 121068.599257524,724265.978503548 121060.290130444,724263.476694515 121052.093888581,724260.575728495 121044.030277402,724257.282594168 121036.118722851,724253.605225062 121028.378284577,724251.951 121025.188) (1 row) postgis14=# select st_astext(st_curvetoline(GeomFromText('COMPOUNDCURVE((723702.522 121248.15,723892.918 121297.093),(723892.918 121297.093,724230.191 121220.96),CIRCULARSTRING(724230.191 121220.96,724268.27 121144.826,724251.951 121025.188))'))); st_astext ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ----------------------------------------------------------------------- LINESTRING(723702.522 121248.15,723892.918 121297.093,724230.191 121220.96,724235.61599542 121214.326233776,724240.708952716 121207.434266306,724245.457602506 121200.300700942,724249.850504877 121192.942723069,724253.877076943 121185.378058699,724257.527618339 121177.624931772,724260.793334591 121169.70202025,724263.666358302 121161.62841112,724266.139768107 121153.423554414,724268.207605344 121145.107216351,724269.864888414 121136.699431717,724271.107624775 121128.220455602,724271.932820567 121119.690714601,724272.338487822 121111.130757609,724272.32364925 121102.561206312,724271.8883406 121094.002705508,724271.033610568 121085.475873377,724269.761518274 121077.001251803,724268.075128299 121068.599256892,724265.978503305 121060.290129786,724263.476694244 121052.0938879,724260.575728195 121044.030276699,724257.282593838 121036.118722128,724253.605224622 121028.378283815,724251.951 121025.188) (1 row) (Note that there are some small rounding errors since the CIRCULARSTRING conversions occur in different places, but again remember that these conversions are lossy) HTH, Mark. -- Mark Cave-Ayland - Senior Technical Architect PostgreSQL - PostGIS Sirius Corporation plc - control through freedom http://www.siriusit.co.uk t: +44 870 608 0063 _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users