[GIS] Problem ‘unable to open datasource” with ogr2ogr to reproject shapefile

coordinate systemogr2ogrshapefile

I have no idea why I get the following error:

FAILURE:
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?

Best Answer

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