Tuesday, 7 January 2020

ogr - How to reproject shapefile using ogr2ogr


I have shapefile in EPSG:2834 and I want to reproject it into EPSG:4326. I am trying to use ogr2ogr in Windows; however, I get this failure output:


C:\Users\Nik\Desktop\Logan_Lines>ogr2ogr -t_srs epsg:4326 spans_4326 spans

FAILURE:
Unable to open datasource `spans' with the following drivers.
-> ESRI Shapefile
-> MapInfo File
-> UK .NTF
-> SDTS
-> TIGER
-> S57
-> DGN
-> VRT

-> REC
-> Memory
-> BNA
-> CSV
-> NAS
-> GML
-> GPX
-> KML
-> GeoJSON
-> Interlis 1

-> Interlis 2
-> GMT
-> SQLite
-> ODBC
-> PGeo
-> OGDI
-> PostgreSQL
-> MySQL
-> XPlane
-> AVCBin

-> AVCE00
-> DXF
-> Geoconcept
-> GeoRSS
-> GPSTrackMaker
-> VFK

C:\Users\Nik\Desktop\Logan_Lines>

I am hoping someone can tell me what I am doing wrong; I have little experience with this tool.




Answer



All that's happening, as far as I can see, is that it cannot find a file called spans. Make sure you provide the path to the file (either relative or absolute), and add the extension, which will be .shp in this case.


If you're still having problems, then it might be that you have a broken Shapefile, see if you can get useful information from ogrinfo, and try loading it into a GIS such as Quantum GIS.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...