Opened 15 years ago

Last modified 2 months ago

#220 new enhancement

Implement ST_Numcurves and ST_CurveN

Reported by: robe Owned by: mleslie
Priority: low Milestone: PostGIS 3.5.0
Component: postgis Version: master
Keywords: Cc:

Description

As Mark L pointed out in #212

Change History (7)

comment:1 by robe, 15 years ago

Owner: changed from pramsey to mleslie

comment:2 by pramsey, 14 years ago

Going to happen Mark? If not, roll to 2.0

comment:3 by pramsey, 14 years ago

Milestone: postgis 1.5.0postgis future

comment:4 by robe, 7 years ago

Milestone: PostGIS FuturePostGIS Fund Me

Milestone renamed

comment:5 by robe, 2 months ago

Milestone: PostGIS Fund MePostGIS 3.5.0

comment:6 by robe, 2 months ago

Examples copied over from #5663 dbaston note

ST_NumCurves(linestring) should be 1

NumCurves is actually more like NumSegments. Here are some examples from MS SQL (which I assume is following ISO)

"SELECT geometry::Parse('LINESTRING (0 0, 1 1, 2 2)').STNumCurves()"

           
-----------
          2

"SELECT geometry::Parse('CIRCULARSTRING (0 0, 1 1, 2 2)').STNumCurves()"

           
-----------
          1

And corresponding ST_CurveN calls:

"SELECT geometry::Parse('LINESTRING (0 0, 1 1, 2 2)').STCurveN(2).ToString()"

                                                                                                                                                                                                                                                                
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
LINESTRING (1 1, 2 2)                                                                                                                                                                                            
"SELECT geometry::Parse('CIRCULARSTRING (0 0, 1 1, 2 2)').STCurveN(1).ToString()"

                                                                                                                                                                                                                                                                
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CIRCULARSTRING (0 0, 1 1, 2 2)    

Damn so maybe not as useful as I thought.

I tried this one on SQL Server to see what a compound would do

SELECT Geometry::STGeomFromText('COMPOUNDCURVE(
(2 2, 2.5 2.5),
CIRCULARSTRING(2.5 2.5, 4.5 2.5, 3.5 3.5),
(3.5 3.5, 2.5 4.5, 3 5)
)',0).STNumCurves()

-- 
4

SELECT Geometry::STGeomFromText('COMPOUNDCURVE(
(2 2, 2.5 2.5),
CIRCULARSTRING(2.5 2.5, 4.5 2.5, 3.5 3.5),
(3.5 3.5, 2.5 4.5, 3 5)
)',0).STCurveN(4).STAsText();

-- 
LINESTRING (2.5 4.5, 3 5)

So sadly not what I was looking for.

Maybe this isn't worth it.

I checked what our ST_DumpSegments does and sadly it seems a bit confused.

SELECT dp.path, ST_AsText(dp.geom)
FROM ST_DumpSegments('COMPOUNDCURVE(
(2 2, 2.5 2.5),
CIRCULARSTRING(2.5 2.5, 4.5 2.5, 3.5 3.5),
(3.5 3.5, 2.5 4.5, 3 5)
)'::geometry) AS dp;

Doesn't give an error but returns no rows.

comment:7 by robe, 2 months ago

Priority: mediumlow
Note: See TracTickets for help on using tickets.