2

Wrestling with Ogr2Ogr again here. I have managed to use it to import a geojson file into a PostGis database, can query and manipulate the database layer. However, when I try and export the database table to a new file I get the message: "Unable to open datasource 'myexport.geojson' with the following drivers"

GeoJson is in the list of drivers, and the layer is in PostGis.

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

2
  • 2
    You should only ask one question. /u/bugmenot123 answered your initial question, you should accept it as correct and ask another question. Commented Mar 27, 2018 at 13:27
  • I've rolled back the question to the state in which it was answered. Once a question has been answered, if you have another question, then ask a new question for it. If the original provides any useful background then you can always include a link to it. Commented Mar 28, 2018 at 8:25

1 Answer 1

4

ogr2ogr expects the destination datasource before the source in the invocation:

Usage: ogr2ogr (...) dst_datasource_name src_datasource_name 

Your line is in the wrong order.

3
  • Thanks that fixed it. Now I'm running into problems getting just a specific table set of data. Will add update. Commented Mar 27, 2018 at 11:55
  • 1
    That is a different problem, please open a new question for that. Commented Mar 27, 2018 at 13:48
  • What's wrong with "select * from with_id"? Is the table listed if you run ogrinfo "PG:host=**** port=**** dbname=**** user=**** password=****" ? Commented Mar 27, 2018 at 19:31

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.