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
]
AndreJ
77.3k5 gold badges89 silver badges164 bronze badges
asked Sep 10, 2016 at 7:31

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.

answered Sep 10, 2016 at 8:26
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.

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

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.