Reputation: 331
I can recreate the missing .shx file by using the gdal command ogr2ogr and specifing the config "--config SHAPE_RESTORE_SHX YES".
But, although it recreates the .shx file it gives me an error: -nln name must be specified combined with a single source layer name, or a -sql statement, and name must be different from an existing layer.
I mean, seems like i'm not using the ogr2ogr command properly. So, how can i recreate it in the correct manner?
Full command
ogr2ogr -f "ESRI Shapefile" -overwrite -skipfailures --config SHAPE_RESTORE_SHX YES file.shp file.shp
Upvotes: 0
Views: 112
Reputation: 1205
Use ogrinfo
instead. Then you don't need to create a new output if you only want to restore the .shx file.
ogrinfo --config SHAPE_RESTORE_SHX YES file.shp
Upvotes: 0
Reputation: 1516
I think the output file name should be different than your input file name.
Upvotes: 0