Skip to content
πŸŽ‰ Apache Sedona 1.9.1 is out now! πŸ—ΊοΈ Geography SQL functions, Box2D & Box3D types, raster Python UDFs & more. Read the release notes β†’

ST_NumPoints

Introduction: Returns number of points in a LineString

ST_NumPoints

Format: ST_NumPoints(geom: geometry)

Return type: Integer

Note

If any other geometry is provided as an argument, an IllegalArgumentException is thrown.

SQL Example:

SELECT ST_NumPoints(ST_GeomFromWKT('MULTIPOINT ((0 0), (1 1), (0 1), (2 2))'))

Output:

IllegalArgumentException: Unsupported geometry type: MultiPoint, only LineString geometry is supported.

SQL Example:

SELECT ST_NumPoints(ST_GeomFromText('LINESTRING(0 1, 1 0, 2 0)'))

Output: 3