Geometry | WKT Format |
Point | POINT (0 0) |
LineString | LINESTRING (0 0, 1 1, 1 2) |
Polygon | POLYGON ((0 0, 4 0, 4 4, 0 4, 0 0), (1 1, 2 1, 2 2, 1 2, 1 1)) |
MultiPoint | MULTIPOINT (0 0, 1 2) |
MultiLineString | MULTILINESTRING ((0 0, 1 1, 1 2), (2 3, 3 2, 5 4)) |
MultiPolygon | MULTIPOLYGON (((0 0, 4 0, 4 4, 0 4, 0 0), (1 1, 2 1, 2 2, 1 2, 1 1)), ((-1 -1, -1 -2, -2 -2, -2 -1, -1 -1))) |
GeometryCollection | GEOMETRYCOLLECTION (POINT(2 3), LINESTRING (2 3, 3 4)) |
ST_Distance(ST_Point(-71.0882, 42.3607), ST_Point(-74.1197, 40.6976)) calculates the distance between two points on a plane, which is 3.4577.
ST_Distance(to_spherical_geography(ST_Point(-71.0882, 42.3607)), to_spherical_geography(ST_Point(-74.1197, 40.6976))) calculates the distance between two points on a sphere, which is 312822.179.Function | Return Value Type | Description |
ST_Point(double, double) | Point | Constructs a point. |
ST_LineFromText(varchar) | LineString | Constructs a linestring from WKT text. |
ST_Polygon(varchar) | Polygon | Constructs a polygon from WKT text. |
ST_GeometryFromText(varchar) | Geometry | Constructs a geometry from WKT text. |
ST_GeomFromBinary(varbinary) | Geometry | Constructs a geometry from WKB text. |
ST_AsText(Geometry) | varchar | Converts a spatial geometry into WKT format. |
to_spherical_geography(Geometry) | SphericalGeography | Converts a plane geometry to a spherical geometry. |
to_geometry(SphericalGeography) | Geometry | Converts a spherical geometry to a plane geometry. |
Function | Return Value Type | Description |
ST_Contains(Geometry, Geometry) | boolean | Returns true if no points of the second geometry lie in the exterior of the first geometry, and at least one point of the interior of the first geometry lies in the interior of the second geometry. This function returns false if the second geometry lies only on the boundary of the first geometry. |
ST_Crosses(Geometry, Geometry) | boolean | Returns true if the two geometries have interior points in common. |
ST_Disjoint(Geometry, Geometry) | boolean | Returns true if the two geometries do not spatially intersect. |
ST_Equals(Geometry, Geometry) | boolean | Returns true if the two geometries are spatially identical. |
ST_Intersects(Geometry, Geometry) | boolean | Returns true if the two geometries share any portion of space. |
ST_Overlaps(Geometry, Geometry) | boolean | Returns true if the two geometries have the same dimension, and one geometry does not completely contain the other geometry. |
ST_Relate(Geometry, Geometry) | boolean | Returns true if the two geometries are related. |
ST_Touches(Geometry, Geometry) | boolean | Returns true if the two geometries share at least one point on their boundaries, but their interiors do not intersect. |
ST_Within(Geometry, Geometry) | boolean | Returns true if the first geometry is completely inside the second geometry. This function returns false if there is an intersection of boundaries. |
Function | Return Value Type | Description |
geometry_nearest_points(Geometry, Geometry) | row(Point, Point) | Returns the closest points between the two geometries. |
geometry_union(array(Geometry)) | Geometry | Combines multiple geometries into one. |
ST_Boundary(Geometry) | Geometry | Returns the closure of a geometry. |
ST_Buffer(Geometry, distance) | Geometry | Returns a polygon that covers all points within a specified distance from the input geometry. |
ST_Difference(Geometry, Geometry) | Geometry | Returns a set of points that are different between the two geometries. |
ST_Envelope(Geometry) | Geometry | Returns the bounding polygon of a geometry. |
ST_ExteriorRing(Geometry) | Geometry | Returns the exterior ring of a polygon. |
ST_Intersection(Geometry, Geometry) | Geometry | Returns the intersection points of the two geometries. |
ST_SymDifference(Geometry, Geometry) | Geometry | Returns a geometry representing the point set symmetric difference (the portions that do not intersect) of the two geometries. |
Function | Return Value Type | Description |
ST_Area(Geometry) | double | Calculates the area of a polygon in plane geometry. |
ST_Area(SphericalGeography) | double | Calculates the area of a polygon in spherical geometry. |
ST_Centroid(Geometry) | Geometry | Returns the centroid of a geometry. |
ST_CoordDim(Geometry) | bigint | Returns the coordinate dimension of a geometry. |
ST_Dimension(Geometry) | bigint | Returns the inherent dimension of a geometry, which must be less than or equal to the coordinate dimension. |
ST_Distance(Geometry, Geometry) | double | Calculates the minimum distance between two geometries in plane geometry. |
ST_Distance(SphericalGeography, SphericalGeography) | double | Calculates the minimum distance between two geometries in spherical geometry. |
ST_IsClosed(Geometry) | boolean | Returns true if the input geometry is closed. |
ST_IsEmpty(Geometry) | boolean | Returns true if the input geometry is an empty geometry collection, polygon, or point. |
ST_IsRing(Geometry) | boolean | Returns true if the input geometry is a closed, simple line. |
ST_Length(Geometry) | double | Calculates the length of a linestring or multi-linestring in plane geometry. |
ST_Length(SphericalGeography) | double | Calculates the length of a linestring or multi-linestring in spherical geometry. |
ST_XMax(Geometry) | double | Returns the X maximum of the bounding box of a geometry. |
ST_YMax(Geometry) | double | Returns the Y maximum of the bounding box of a geometry. |
ST_XMin(Geometry) | double | Returns the X minimum of the bounding box of a geometry. |
ST_YMin(Geometry) | double | Returns the Y minimum of the bounding box of a geometry. |
ST_StartPoint(Geometry) | point | Returns the first point of a LineString geometry. |
ST_EndPoint(Geometry) | point | Returns the last point of a LineString geometry. |
ST_X(Point) | double | Returns the X coordinate of a point. |
ST_Y(Point) | double | Returns the Y coordinate of a point. |
ST_NumPoints(Geometry) | bigint | Calculates the number of points in a geometry. |
ST_NumInteriorRing(Geometry) | bigint | Returns the number of interior rings in a polygon. |
피드백