2

I have looked at other Q&As on the subject and none have solved my problem.

My problem is similar to the first referenced Q&A where my error says 'unable to open datasource'. I downloaded the test dataset in the solution and still did not work. My set up of ogr2ogr looks like this:

ogr2ogr -f "PostgreSQL" PG:"host=pg.rambck.local dbname=projects user=david password=xxxxxx" \\source\gdbname.gdb\datasetname -nln v1_dataset

When I run ogrinfo on the test dataset I get error: Unable to open datasource 'C:\david\trecks.gdb'

When I run ogr2ogr on my set up I get error: Unable to open datasource 'host=pg.rambck.local dbname=projects.......'

OpenFileGDB is listed in the list of drivers. What am I doing wrong?

  • No idea really. What is your GDAL version that is reported by ogrinfo --version? Do you get any more information by trying to read Trecks.gdb with ogrinfo including option --debug on? – user30184 Mar 1 '17 at 17:58
  • GDAL 1.11.3, released 2015/09/16 OGR: OGROpen(C:\david\trecks.gdb) failed. OGR: OGROpen(C:\david\trecks.gdb) failed. Failure to open datasource 'C:\david\trecks.gdb' with the following dirvers...... – D_C Mar 1 '17 at 18:40
  • I would have a try with more recent version. I suppose that your path to gdb is correct and you have unzipped everything. – user30184 Mar 1 '17 at 18:48
0

I think the previous answer alluded to it, but at least one problem is that you are combining your dataset name with the data source. They need to be separate. Here is an example from the GDAL website:
ogr2ogr -overwrite -f "PostgreSQL" PG:"host=myhost user=myuser dbname=mydb password=mypass" "C:\somefolder\BigFileGDB.gdb" "MyFeatureClass"
So, based on that, your string should look something like this:
ogr2ogr -f "PostgreSQL" PG:"host=pg.rambck.local dbname=projects user=david password=xxxxxx" "\\source\gdbname.gdb" "datasetname" -nln v1_dataset
One thing that can trip people up is that the FileGDB drivers don't pay attention to Feature Datasets inside the GDB, so you shouldn't reference them in your file path at all. I don't think this is an issue in your situation, but could be confusing to others.

0

Try

 ogr2ogr -f "PostgreSQL" PG:"host=pg.rambck.local dbname=projects user=david password=xxxxxx" \source\gdbname.gdb \datasetname

between the gdb path and db name there is a space should be careful. If still not work, check your user settings in your PG project.

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.