Point Constructors
Returns a POINT that is the geographic center of mass of a specified geospatial object.
The geographic center of mass is calculated by taking the average of all points on a three-dimensional sphere, projecting the resultant point onto the sphere, and converting it back to latitude and longitude coordinates.
Syntax
Argument | Data Type | Description |
---|---|---|
geo | POINT, LINESTRING, or POLYGON | A geospatial object that the function analyzes to compute its geometric center. |
use_spheroid | BOOLEAN | Optional. If this argument is TRUE, the function computes the centroid using a spheroid model instead of a spherical model. If you do not specify this value, the value defaults to FALSE. |
Example
Output: POINT(1.66 1.33)
Alias for ST_POLYGON(ST_LINESTRING(ARRAY(ST_POINT(lon, lat)))).
Creates and returns a POLYGON geography with a single point, defined by the longitude and latitude specified for the function.
Syntax
Argument | Data Type | Description |
---|---|---|
lon | DOUBLE | A longitude coordinate to be used to create a POLYGON with a single point. |
lat | DOUBLE | A latitude coordinate to be used to create a POLYGON with a single point. |
Example
Output: POLYGON((41.882548 -87.63922))
Alias for ST_POINT.
Creates a POINT from the specified input arguments.
Alias for ST_POINTFROMWKB.
Creates a POINT from the specified BINARY value, which must represent a point in WKB format.
Syntax
Argument | Data Type | Description |
---|---|---|
binary | BINARY | A binary value in WKB format that represents a POINT. |
Example
Output: POINT(1 2)
Creates a POINT from a CHAR value that represents a point in WKT format.
Syntax
Argument | Data Type | Description |
---|---|---|
char | CHAR | A CHAR that represents a POINT in WKT format. |
Example
Output: POINT(1 2)
Creates a POINT defined with the values provided for the longitude and latitude coordinates.
Syntax
Argument | Data Type | Description |
---|---|---|
lon | DOUBLE | A DOUBLE value that represents a longitude coordinate. |
lat | DOUBLE | A DOUBLE value that represents a latitude coordinate. |
Example
Output: POINT(87.6386 41.8843)
Alias for ST_POINT.
Creates a POINT using an EWKT-formatted CHAR as an input argument.
Syntax
Argument | Data Type | Description |
---|---|---|
srid_char | CHAR | A string that includes an SRID value and an EWKT-formatted value that represents a POINT. Separate the values in the string by a semicolon using this format: 'SRID = value; point_value' The input string must include the SRID = value; component. However, the database ignores this component as all geography types are SRID = 4326. |
Example
Output: POINT(1 2)
Creates a POINT represented by the specified GeoJSON value as an input argument. A second optional BOOLEAN argument determines if the specified GeoJSON should be converted from a planar to a geodesic representation.
If you specify a NULL value for either argument, the function returns NULL.
Syntax
Argument | Data Type | Description |
---|---|---|
geo_json | STRING | A string of a GeoJSON. Valid GeoJSON formats follow IETF standards, which you can generate by using the ST_ASGEOJSON function. If you specify an invalid GeoJSON, the behavior of the function is undefined. The function returns NULL if any argument is NULL. |
geodesic | BOOLEAN | Optional. If you set this argument to TRUE, the specified GeoJSON is converted from a planar to a geodesic representation. This has no effect on POINT geospatial objects. If you do not specify this value, defaults to FALSE. |
Examples
In this example, the function is capturing a POINT from an empty GeoJSON representation.
Output: POINT EMPTY
In this example, the function is capturing a POINT from a GeoJSON representation.
Output: POINT(1 1)
Creates a POINT represented by the specified geohash.
Syntax
Argument | Data Type | Description |
---|---|---|
geohash | STRING | A string of a valid geohash. Valid geohashes contain only the characters 0123456789bcdefghjkmnpqrstuvwxyz. If you specify an invalid geohash, the function throws an INVALID_ARGUMENT error. The function returns NULL if this argument is NULL. |
Examples
Output: POINT(-126.00000000000003 48.00000000000007)
Output: POINT(42.60498046875 -5.60302734375)
Alias for ST_POINT(char).
Alias for ST_POINT(binary).