Name

ST_NumCurves — Return the number of component curves in a CompoundCurve.

Synopsis

integer ST_NumCurves(geometry a_compoundcurve);

Description

Return the number of component curves in a CompoundCurve, zero for an empty CompoundCurve, or NULL for a non-CompoundCurve input.

This method implements the SQL/MM specification. SQL-MM 3: 8.2.6, 8.3.5

This function supports 3d and will not drop the z-index.

Examples

This CompoundCurve contains three component curves.

Code
SELECT ST_NumCurves('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,2 2)
  )');
Output
3
Figure
Geometry figure for visual-st-numcurves-01

An empty CompoundCurve has no component curves.

Code
SELECT ST_NumCurves('COMPOUNDCURVE EMPTY');
Output
0