- Categories:
ST_NPOINTS , ST_NUMPOINTS¶
Returns the number of points in a GEOGRAPHY or GEOGRAPHY object.
Syntax¶
Arguments¶
geography_or_geometry_expressionThe argument must be an expression of type GEOGRAPHY or GEOMETRY.
Returns¶
Returns a value of type INTEGER.
Usage notes¶
Each Polygon loop lists the starting point twice (once as the start, once as the end). ST_NPOINTS counts both occurrences. For example, given a triangular Polygon, ST_NPOINTS returns 4, not 3.
ST_NUMPOINTS is an alias for ST_NPOINTS.
Note
In some other systems, ST_NUMPOINTS behaves differently from ST_NPOINTS and returns the number of points for LineString / MultiLineString objects only.
Examples¶
GEOGRAPHY examples¶
This shows the number of points in a simple Polygon.
GEOMETRY examples¶
The following example demonstrates how to use the ST_NPOINTS function.