Appearance
ST_ASGEOJSON
Converts a GEOGRAPHY object into a GeoJSON representation that follows RFC 7946 specifications. Returns the GEOGRAPHY as a GeoJSON Geometry Object.
See also:
Syntax
sql
ST_ASGEOJSON(<input>)Arguments
<input>: AGEOGRAPHYobject to convert
Returns
Returns a JSON value containing the GeoJSON representation of the input GEOGRAPHY.
Example
sql
SELECT ST_AsGeoJSON('POINT(1 1)'::GEOGRAPHY);
-- {"type":"Point","coordinates":[1,1]}Note: This function is equivalent to casting GEOGRAPHY to JSON using the ::JSON syntax.