0

I have an ESRI Shapefile that I can open in ArcMap and QGIS and show the attributes fine. However when I try to load to PostGIS using ogr2ogr I get an error saying

ERROR 1: ERROR:  zero-length delimited identifier at or near """"
LINE 1: ALTER TABLE "attribute" ADD COLUMN "" VARCHAR(5)

I used ogrinfo -al File.shp and it lists all 20 records fine but none of the attributes seem to come through.

I have opened the dbf file in Excel and its fine and have even parsed the dbf header using Python and it is exactly the same header output as a previous shapefile which correctly loads.

Why is ogr2ogr having an issue parsing the file?

4
  • what are your column/attribute names? Is it possible one of them is not a valid PostGresql name?
    – Ian Turton
    Commented Apr 26, 2019 at 7:16
  • 1
    trying to translate to GPKG causes the attributes fields to be named 1,2,3,4,5 etc. So it must be something about reading the shapefile header and its attribute names.
    – tjmgis
    Commented Apr 26, 2019 at 13:41
  • How does ogrinfo list the attributes with ogrinfo -al -so your_shapefile.shp?
    – user30184
    Commented Apr 28, 2019 at 17:31
  • possible problem with primary key in shapefile? stackoverflow.com/questions/23165282/…
    – nmtoken
    Commented Jun 15, 2020 at 9:52

1 Answer 1

0

I don' know PostGIS, but if it reads fine in other formats, that suggests the ogr2ogr is the problem. If postGIS can read some other format, or do something like shp2ogr, that seems worth a try.

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.