Monday 30 April 2018

postgresql - Error while exporting GeoJSON from PostGIS


$ ogr2ogr -f "GeoJSON" test.geojson -t_srs EPSG:4326 PG:"host=localhost user=postgres dbname=sp_join port=5432" -sql 'select gid, geom from test'

I am using the following code in ogr2ogr to export a table from PostGIS to GeoJSON, but get the following errors:


ERROR 1: Reading EWKB with 4-dimensional coordinates (XYZM) is not supported
ERROR 1: Reading EWKB with 4-dimensional coordinates (XYZM) is not supported
ERROR 1: Reading EWKB with 4-dimensional coordinates (XYZM) is not supported

ERROR 1: Reading EWKB with 4-dimensional coordinates (XYZM) is not supported
ERROR 1: Reading EWKB with 4-dimensional coordinates (XYZM) is not supported
ERROR 1: Reading EWKB with 4-dimensional coordinates (XYZM) is not supported

How can I avoid 4-dimensional coordinates?



Answer



You can remove unwanted ordinates with any of:



So you could modify your -sql argument like this:


-sql 'select gid, st_force2d(geom) from test'

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...