-
Notifications
You must be signed in to change notification settings - Fork 1
Geometry Output
Idan Sheinberg edited this page Dec 16, 2022
·
3 revisions
Description: Serialize geometry data to WKT format
Input Argument #1: Geometry (WKB)
Output: Text (WKT)
SELECT ST_AsText(
ST_GeomFromText(
'POINT (121.0 22.5)'
)
)
Result
POINT (121.0 22.5)
Description: Serialize geometry data to EWKT format
Input Argument #1: Geometry (WKB)
Output: Text (EWKT)
SELECT ST_AsEWKT(
ST_GeomFromText(
'POINT (121.0 22.5)',3857
)
)
Result
SRID=3857;POINT (121.0 22.5)
Description: Serialize geometry data to GeoJson format
Input Argument #1: Geometry (WKB)
Output: Text (GeoJson)
SELECT ST_AsGeoJson(
ST_GeomFromText(
'LINESTRING (121.0 22.5, 90.0 -10.2)'
)
)
Result
{"type":"LineString","coordinates":[[121,22.5],[90,-10.2]],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}}