[postgis-users] Converting a LineString to a CompoundCurve
Neumann, Andreas
a.neumann at carto.net
Fri Oct 7 03:41:02 PDT 2016
Hi Strk,
Yes - ST_ForceCurve() - that's the function I was looking for. Thank you
very much!
Thanks also for explaining, that ST_LineToCurve() falls back to
LineString if it can't generate a curve.
Andreas
On 2016-10-07 11:28, Sandro Santilli wrote:
> On Fri, Oct 07, 2016 at 09:12:18AM +0200, Andreas Neumann wrote:
>
>> Hi,
>>
>> I am trying to convert a LineString to a CompoundCurve.
>>
>> I was trying ST_LineToCurve(), but it seems to return again a LineString ;-(
>>
>> Casting with ::geometry(CompoundCurve,21781) doesn't work either.
>>
>> Is this impossible to do or did I miss something?
>
> ST_LineToCurve was probably unable to find a curve
> (you may want to file a ticket for this if you think it should have done it).
>
> In that case, it usually puts the result as a straight line
> inside a COMPOUNDCURVE (a collection) - but as a final step,
> if the output collection has a single element that element
> is returned instead of the collection, so you end up with a simple
> line (it's opinable if this is a good or bad idea).
>
>> The reason I want to do it, is that I have some road data which is in
>> CompoundCurve type. I want to use ST_LineStubstring() on this geometry, so I
>> use ST_CurveToLine(). I want to convert the result back into a
>> CompoundCurve, for being able to store it in a table which has a constraint
>> on CompoundCurve type.
>
> You can get back to the COMPOUND by using ST_ForceCurve (new in 2.2.0).
>
> --strk;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20161007/056d8918/attachment.html>
More information about the postgis-users
mailing list