2
$ 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?

  • 2
    use -dim XY or similar – Mike T Dec 12 '16 at 1:10
  • thanks. where would that go in the ogr2ogr request? – the_darkside Dec 12 '16 at 1:12
  • 1
    anywhere near the end; see usage for ogr2ogr – Mike T Dec 12 '16 at 2:11
3

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'
| improve this answer | |
  • thanks, how would that be included in the code? I try select gid, geom from test; ST_Force2D(geom) and get a syntax error – the_darkside Dec 12 '16 at 1:16
  • Do not change the correct syntax that is used in the answer. – user30184 Dec 12 '16 at 5:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.