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.

Can anyone help me understand why ogr2ogr is having an issue parsing the file?

  • what are your column/attribute names? Is it possible one of them is not a valid PostGresql name? – Ian Turton Apr 26 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 Apr 26 at 13:41
  • How does ogrinfo list the attributes with ogrinfo -al -so your_shapefile.shp? – user30184 Apr 28 at 17:31
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, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.