Skip to main content

ST_ASGEOJSON

Introduced or updated: v1.2.427

Converts a GEOMETRY object into a GeoJSON representation.

Syntax

ST_ASGEOJSON(<geometry>)

Arguments

ArgumentsDescription
<geometry>The argument must be an expression of type GEOMETRY.

Return Type

Variant.

Examples

SELECT
ST_ASGEOJSON(
ST_GEOMETRYFROMWKT(
'SRID=4326;LINESTRING(400000 6000000, 401000 6010000)'
)
) AS pipeline_geojson;

┌─────────────────────────────────────────────────────────────────────────┐
│ pipeline_geojson │
├─────────────────────────────────────────────────────────────────────────┤
│ {"coordinates":[[400000,6000000],[401000,6010000]],"type":"LineString"} │
└─────────────────────────────────────────────────────────────────────────┘
Did this page help you?
Yes
No
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today