Geometry Accessors
st_boundary
Geometry st_boundary(Geometry geom)
This function returns the boundary, or an empty geometry of appropriate dimension, if geom is empty.
Example:
st_coordDim
Int st_coordDim(Geometry geom)
This function returns the number of dimensions of the coordinates of Geometry geom.
Example:
st_dimension
Int st_dimension(Geometry geom)
This function returns the inherent number of dimensions of this Geometry object, which must be less than or equal to the coordinate dimension.
Example:
st_envelope
Geometry st_envelope(Geometry geom)
This function returns a Geometry representing the bounding box of geom.
Example:
st_exteriorRing
LineString st_exteriorRing(Geometry geom)
This function returns a LineString representing the exterior ring of the geometry; returns null if the Geometry is not a Polygon.
Example:
st_geometryN
Geometry st_geometryN(Geometry geom, Geometry n)
This function returns the nth Geometry (1-based index) of geom if the Geometry is a GeometryCollection, or geom if it is not.
Example:
st_interiorRingN
Geometry st_interiorRingN(Geometry geom, Int n)
This function returns the nth interior LineString ring of the Polygon geom. If the geometry is not a Polygon or the given n is out of range, this function returns null.
Example:
st_isClosed
Boolean st_isClosed(Geometry geom)
This function returns true if geom is a LineString or MultiLineString and its start and end points are coincident. This function returns true for all other Geometry types.
Example:
- Query command:
select st_isClosed(st_geomFromWKT(location)) from geotbl where id='6'
- The query result is as follows:
TRUE
st_isCollection
Boolean st_isCollection(Geometry geom)
This function returns true if geom is a GeometryCollection.
Example:
st_isEmpty
Boolean st_isEmpty(Geometry geom)
This function returns true if geom is empty.
Example:
st_isRing
Boolean st_isRing(Geometry geom)
This function returns true if geom is a LineString or a MultiLineString and is both closed and simple.
Example:
st_isSimple
Boolean st_isSimple(Geometry geom)
This function returns true if geom has no anomalous geometric points, such as self intersection or self tangency.
Example:
st_isValid
Boolean st_isValid(Geometry geom)
This function returns true if the Geometry is topologically valid according to the OGC SFS specification.
Example:
st_numGeometries
Int st_numGeometries(Geometry geom)
If geom is a GeometryCollection, this function returns the number of geometries. Otherwise, it returns 1.
Example:
st_numPoints
Int st_numPoints(Geometry geom)
This function returns the number of vertices in Geometry geom.
Example:
st_pointN
Point st_pointN(Geometry geom, Int n)
If geom is a LineString, this function returns the nth vertex of geom as a point. Negative values are counted backwards from the end of the LineString. This function returns null if geom is not a LineString.
Example:
st_x
Float st_x(Geometry geom)
If geom is a point, this function returns the X coordinate of that point.
Example:
Last Article: Geometry Constructors
Next Article: Geometry Cast
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.