10

I have no idea why I get the following error:

Unable to open datasource `Sydney2.shp' with the following drivers.

I have already checked successfully the shape with ogrinfo.

I am using the following command:

ogr2ogr -f "ESRI Shapefile" Sydney.shp Sydney2.shp -s_srs EPSG:32656 -t_srs EPSG:4326

Any ideas?

0

1 Answer 1

13

It looks like you're expecting to convert data in Sydney.shp to Sydney2.shp with a different SRS. However that isn't what you're doing.

   Usage: ogr2ogr [--help-general] [-skipfailures] [-append] [-update]
                  [-select field_list] [-where restricted_where]
                  [-progress] [-sql <sql statement>] [-dialect dialect]
                  [-preserve_fid] [-fid FID]
                  [-spat xmin ymin xmax ymax]
                  [-a_srs srs_def] [-t_srs srs_def] [-s_srs srs_def]
                  [-f format_name] [-overwrite] [[-dsco NAME=VALUE] ...]
                  dst_datasource_name src_datasource_name
                  [-lco NAME=VALUE] [-nln name] [-nlt type] [-dim 2|3] [layer [layer ...]]

Note that the destination comes first, so you're asking it to copy from Sydney2.shp to Sydney.shp. You probably wanted:

ogr2ogr -f "ESRI Shapefile" Sydney2.shp Sydney.shp -s_srs EPSG:32656 -t_srs EPSG:4326
4
  • 1
    Thanx, thats it. I have to change the position of the source and destination file. Quite easy, i better read the syntax more closely next time :-E Commented Nov 14, 2014 at 11:07
  • 4
    You are not the only one. GDAL is using target-source order in most vector tools but source-target in raster tools.
    – user30184
    Commented Nov 14, 2014 at 11:35
  • 1
    Indeed its a problem that some of us have seen before :-)
    – BradHards
    Commented Nov 14, 2014 at 22:14
  • I was almost struggling for half an hour with a stupid bug. I was putting the input and ouput the other way around. Thanks buddy! you saved my morning! :D Commented Mar 18, 2021 at 11:07

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.