2

I want to covert the .shp file to .csv file by using ogr2ogr and I am running

PGCLIENTENCODING=UTF8 ogr2ogr -f CSV "/home/pj/Desktop/test1.csv" "/home/pj/Desktop/20160705102900718.shp"

but the shell prompt

ERROR 4: Unable to open /home/pj/Desktop/20160705102900718.shx or /home/pj/Desktop/20160705102900718.SHX.
FAILURE:
Unable to open datasource `/home/pj/Desktop/20160705102900718.shp' with the following drivers.
  -> ESRI Shapefile
  -> MapInfo File
  -> UK .NTF
  -> SDTS
  -> TIGER
  -> S57
  -> DGN
  -> VRT
  -> REC
  -> Memory
  -> BNA
  -> CSV
  -> NAS
  -> GML
  -> GPX
  -> LIBKML
  -> KML
  -> GeoJSON
  -> Interlis 1
  -> Interlis 2
  -> GMT
  -> SQLite
  -> DODS
  -> ODBC
  -> PGeo
  -> MSSQLSpatial
  -> OGDI
  -> PostgreSQL
  -> MySQL
  -> PCIDSK
  -> XPlane
  -> AVCBin
  -> AVCE00
  -> DXF
  -> Geoconcept
  -> GeoRSS
  -> GPSTrackMaker
  -> VFK
  -> PGDump
  -> OSM
  -> GPSBabel
  -> SUA
  -> OpenAir
  -> PDS
  -> WFS
  -> HTF
  -> AeronavFAA
  -> Geomedia
  -> EDIGEO
  -> GFT
  -> SVG
  -> CouchDB
  -> Idrisi
  -> ARCGEN
  -> SEGUKOOA
  -> SEGY
  -> XLS
  -> ODS
  -> XLSX
  -> ElasticSearch
  -> PDF
]

2 Answers 2

2

A shapefile consists of a bunch of files. The .shp and .shx are mandatory, .dbf and .prj are necessary for some tasks as well.

The error message notes that the .shx file for your .shp file is missing. If you rename the .shp file to match the naming conventions, make sure to rename the .shx file as well.

0
0

I think the problem is in your shapefile name. You need to rename your shapefile to start with letters because shapefiles cannot start with numbers.

1
  • no,when I rename my shapefile to test.shp,it is prompt this error too
    – PengJ
    Sep 10, 2016 at 7:56

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.