ST_ASGEOJSON
functionsupportedCore SQL functionsGiven a value of type GEOGRAPHY or GEOMETRY, return the GeoJSON representation of that value.
Syntax
ST_ASGEOJSON( <geography_or_geometry_expression> )
Parameters
| Name | Required | Description |
|---|---|---|
geography_or_geometry_expression | required | The argument must be an expression of type GEOGRAPHY or GEOMETRY. |
Returns
An OBJECT in GeoJSON format.
Usage notes
- For GEOMETRY objects:
- The returned GEOMETRY object uses the same coordinate system as the input GEOMETRY object. Note that the GeoJSON specification requires that geometry be in the WGS84 coordinate system (SRID = 4326). However, the ST_ASGEOJSON function does not enforce this.
- The function does not add the SRID or any other CRS information to the output.