Skip to main content
conversion functions transform a specified operand to a different data type.

ST_ASBINARY

Alias of ST_ASWKB. Returns the well-known binary (WKB) representation of the specified geography. Syntax
SQL
Example
SQL
Output: 010100000000000000000000400000000000000040

ST_ASGEOJSON

Returns the GeoJSON representation of the specified geography using the IETF standards.
SQL
Examples This example converts a POINT value into a GeoJSON representation.
SQL
Output:
Text
This example converts an empty POINT value.
SQL
Output:
Text
This example converts a LINESTRING value into a GeoJSON representation.
SQL
Output:
Text
This example again converts a LINESTRING value.
SQL
Output:
Text
This example converts an empty LINESTRING value into a GeoJSON representation.
SQL
Output:
Text
This example converts a POLYGON value into a GeoJSON representation.
SQL
Output:
Text
This example again converts a POLYGON value.
SQL
Output:
Text
This example converts a two-point POLYGON, which results in a LINESTRING type in the GeoJSON representation.
SQL
Output:
Text
This example converts a single-point POLYGON, which results in a POINT type in the GeoJSON representation.
SQL
Output:
Text
This example converts an empty POLYGON value into a GeoJSON representation.
SQL
Output:
Text

ST_ASLATLONTEXT

Returns a string that represents geographic coordinates of a specified POINT in the specified format.
SQL
Example
SQL
Output: '2.0 degrees 19.50 minutes S 10.0 degrees 14.05 minutes E'

ST_ASTEXT

Alias of ST_ASWKT and ST_EWKT. Returns the well-known text (WKT) representation of the specified geography. If you use ST_ASEWKT, the database prepends the resultant string with SRID=4326;.
SQL
Example
SQL
Output: POLYGON((1 2, 1 3, 1 3, 1 2))

ST_ASEWKT

For usage, see ST_ASTEXT.

ST_ASWKT

Alias of ST_ASTEXT.

ST_ASWKB

Alias of ST_ASBINARY.

ST_GEOHASH

Returns a string that represents the geohash of the input POINT. This function also accepts an optional second argument to specify the length of the geohash result. If you specify any argument as NULL, then the function returns NULL.
SQL
Example
SQL
Output: c0w3hc0w3hf1s70w3hf1s70w3 Geospatial Data Types Attribute Functions
Last modified on May 20, 2026