Functions that return information about geometries within a geometry

The following functions return information about geometries within a geometry.

ST_Centroid

ST_Centroid takes a geometry as an input parameter and returns the geometric center, which is the center of the minimum bounding rectangle of the given geometry, as a point.

The resulting point is represented in the spatial reference system of the given geometry. If the given geometry is null, then null is returned.

ST_EndPoint

ST_EndPoint takes a linestring as an input parameter and returns the point that is the last point of the linestring.

The resulting point is represented in the spatial reference system of the given linestring. If the given linestring is null or empty, then null is returned.

ST_GeometryN

ST_GeometryN takes a geometry collection and an index as input parameters and returns the geometry in the collection that is identified by the index.

The resulting geometry is represented in the spatial reference system of the given geometry collection. If the given geometry is null or is empty, then null is returned.

ST_NumGeometries

ST_NumGeometries takes a geometry collection as an input parameter and returns the number of geometries in the collection.

If the given geometry collection is null or empty, then null is returned.

ST_NumPoints

ST_NumPoints takes a geometry as an input parameter and returns the number of points that were used to define that geometry.

For example, if the geometry is a polygon and five points were used to define that polygon, then the returned number is 5.

ST_PointN

ST_PointN takes a linestring or a multipoint and an index as input parameters and returns that point in the linestring or multipoint that is identified by the index. The resulting point is represented in the spatial reference system of the given linestring or multipoint.

If the given linestring or multipoint is null or is empty, then null is returned. If the index is smaller than 1 or larger than the number of points in the linestring or multipoint, then null is returned and a warning is returned.

ST_StartPoint

ST_StartPoint takes a linestring as an input parameter and returns the point that is the first point of the linestring.

The resulting point is represented in the spatial reference system of the given linestring. This result is equivalent to the function call ST_PointN(linestring, 1). If the given linestring is null or empty, then null is returned.