Opened 7 years ago

Closed 7 years ago

#3903 closed defect (invalid)

ST_AsGeoJSON not working with LineStringM

Reported by: ccsmith Owned by: pramsey
Priority: medium Milestone: PostGIS 2.4.1
Component: postgis Version: 2.1.x
Keywords: ST_AsGeoJSON, LineStringM Cc:

Description

When using ST_AsGeoJSON with a LineStringM or LineStringMZ (and coordinate values for the M dimension) geometry there is no resulting coordinate output for the M dimension.

--POSTGIS VERSION SELECT PostGIS_full_version(); "POSTGIS="2.1.8 r13780" GEOS="3.5.0-CAPI-1.9.0 r4084" PROJ="Rel. 4.9.2, 08 September 2015" GDAL="GDAL 1.11.5, released 2016/07/01" LIBXML="2.9.1" LIBJSON="UNKNOWN" RASTER"

--LINESTRING select ST_ASgeojson(ST_GeomFromText('LINESTRING(1 0, 2 0, 4 0)')); {"type":"LineString","coordinates":1,0],[2,0],[4,0}

--LINESTRINGM select ST_ASgeojson(ST_GeomFromText('LINESTRINGM(1 0 0, 2 0 10, 4 0 20)')); {"type":"LineString","coordinates":[[1,0],[2,0],[4,0]]}

--LINESTRINGZ select ST_ASgeojson(ST_GeomFromText('LINESTRINGz(1 0 0, 2 0 10, 4 0 20)')) ; {"type":"LineString","coordinates":1,0,0],[2,0,10],[4,0,20}

--LINESTRINGZM select ST_ASgeojson(ST_GeomFromText('LINESTRINGZM(1 0 0 0, 2 0 10 0, 4 0 20 0)')) {"type":"LineString","coordinates":[[1,0,0],[2,0,10],[4,0,20]]}

Change History (1)

comment:1 by pramsey, 7 years ago

Resolution: invalid
Status: newclosed

According to both the old and new specs, GeoJson has no business including anything other than X, Y and optionally Z.

https://tools.ietf.org/html/rfc7946#page-7

Note: See TracTickets for help on using tickets.