[GIS] lwgeom_to_geojson: ‘PolyhedralSurface’ geometry type not supported

geojsonpostgispostgresqlsfcgal

I am using PostGIS (PostGIS 2.2.0 with SFCGAL extension) and I have data in postgres which is loaded using citygml2psql tool and it contains polyhedralSurface geometry.

But when i run query :

SELECT "gid",ST_AsGeoJSON(ST_Transform("geom"::geometry,3946),0, 1) AS "geom"  FROM "public"."citygml"

in pgadmin3 it gives an error :

ERROR:  lwgeom_to_geojson: 'PolyhedralSurface' geometry type not supported
********** Error **********
ERROR: lwgeom_to_geojson: 'PolyhedralSurface' geometry type not supported
SQL state: XX000

I found one question related to this here : GeoJSON: PolyhedralSurface geometry type not supported

But i want some fix for postgis as I can't change my query and need data in GeoJSON.

Best Answer

The error message and specifications are pretty clear:

GeoJSON supports the following geometry types: Point, LineString, Polygon, MultiPoint, MultiLineString, and MultiPolygon.

PolyhedralSurface is not in that list, so you'll need to convert it to another geometry type.

Related Question