ST_AsGeoJSON

This section contains reference documentation for the ST_AsGeoJSON function.

Returns the GeoJSON representation of the given geometry or geography.

Signature

ST_AsGeoJSON(geometryObject)

Arguments
Description

geometryObject

A geometry or geography object.

Usage Examples

select stAsGeoJSON( STPOINT(-122, 37) ) AS value
from ignoreMe
value

{"type":"Point","coordinates":[-122,37],"crs":{"type":"name","properties":{"name":"EPSG:0"}}}

select stAsGeoJSON( ST_GeogFromText('LINESTRING (30 10, 10 30, 40 40)') ) AS value
from ignoreMe 
value

{"type":"LineString","coordinates":[[30,10],[10,30],[40,40]],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}}

Last updated