1

I'm exporting from PostGis to GeoJson, but appear to have no control over the table it retrieves. Have tried the following methods:

.\ogr2ogr -f "GeoJSON" "C:\Temp\output.geojson" "PG:host=**** port=**** dbname=**** user=**** password=****" -sql "SELECT * FROM with_id"

  • SELECT from table with_id failed, no such table/featureclass.

.\ogr2ogr -f "GeoJSON" "C:\Temp\output.geojson" "PG:host=**** port=**** dbname=**** user=**** password=****" -sql "SELECT * FROM public.with_id"

  • Unable to open secondary datasource `public' required by JOIN.

.\ogr2ogr -f "GeoJSON" "C:\Temp\output.geojson" "PG:host=**** port=**** dbname=**** user=**** password=****" with_id

  • Couldn't fetch requested layer 'with_id'!

.\ogr2ogr -f "GeoJSON" "C:\Temp\output.geojson" "PG:host=**** port=**** dbname=**** user=**** password=****" public.with_id

  • Couldn't fetch requested layer 'public.with_id'!
2
  • try excluding PG: from the quotes.
    – geozelot
    Commented Mar 28, 2018 at 10:36
  • Does ogrinfo list the table "with_id" if you run "ogrinfo PG:host=**** port=**** dbname=**** user=**** password=****?
    – user30184
    Commented Mar 28, 2018 at 14:53

1 Answer 1

1

You simply don't have a table called public.with_id.

Try dumping it regularly with pg_dump. My guess is you're connected to the wrong database.

1
  • Looks like Ogr2Ogr is clever, and removes _. There I go making assumptions again. Commented Apr 3, 2018 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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