コンテンツにスキップ

GEOMETRYオブジェクトをGeoJSON表現に変換します。

ST_ASGEOJSON(<geometry>)
引数 説明
<geometry> GEOMETRY型の式を指定する必要があります。

Variant。

SELECT
ST_ASGEOJSON(
ST_GEOMETRYFROMWKT(
'SRID=4326;LINESTRING(400000 6000000, 401000 6010000)'
)
) AS pipeline_geojson;
┌─────────────────────────────────────────────────────────────────────────┐
│ pipeline_geojson │
├─────────────────────────────────────────────────────────────────────────┤
│ {"coordinates":[[400000,6000000],[401000,6010000]],"type":"LineString"} │
└─────────────────────────────────────────────────────────────────────────┘