0

I am trying to import .shp to PgAdmin III but is error because of "dbf file can not be opened" and I dont understand why. enter image description here

  • First thing that I would test is to rename shapefile into something simple like test.shp and place is into c:\data for avoiding problems caused by special characters and spaces. All parts of the shapefile must naturally be renamed and moved. – user30184 Apr 24 '17 at 18:08
  • try a folder without the dot and diacritic characters (example c:\temp) – Mapperz Apr 24 '17 at 18:09
  • It is works , but second problem is: Importing with configuration: kraj, public, geom, C:\data\kraj.shp, mode=c, dump=1, simple=0, geography=0, index=1, shape=1, srid=0 Unable to convert field name to UTF-8 (iconv reports "Illegal byte sequence"). Current encoding is "UTF-8". Try "LATIN1" (Western European), or one of the values described at gnu.org/software/libiconv. Shapefile import failed. – majus251 Apr 25 '17 at 8:10
  • and when I try LATIN1: Importing with configuration: kraj, public, geom, C:\data\kraj.shp, mode=c, dump=1, simple=0, geography=0, index=1, shape=1, srid=0 Shapefile type: Polygon PostGIS type: MULTIPOLYGON[2] Failed in pgui_exec(): ERROR: invalid byte sequence for encoding "UTF8": 0xe3 0xa1 0x74 Shapefile import failed. – majus251 Apr 25 '17 at 8:10
1

I think this error happens:

  • If the dbf is missing or corrupt (note it should have the same name as the .shp (but with .dbf extension).
  • If the file is present and not obviously corrupt (Like it has more than 0 bytes)

Try opening the .dbf file in LibreOffice spreadsheet or Microsoft Excel to verify it's readable.

Also as noted by some others, probably would help to have a folder name with just ASCII characters.

  • It is works , but second problem is: Importing with configuration: kraj, public, geom, C:\data\kraj.shp, mode=c, dump=1, simple=0, geography=0, index=1, shape=1, srid=0 Unable to convert field name to UTF-8 (iconv reports "Illegal byte sequence"). Current encoding is "UTF-8". Try "LATIN1" (Western European), or one of the values described at gnu.org/software/libiconv. Shapefile import failed – majus251 Apr 25 '17 at 9:01
  • and when I try LATIN1: Importing with configuration: kraj, public, geom, C:\data\kraj.shp, mode=c, dump=1, simple=0, geography=0, index=1, shape=1, srid=0 Shapefile type: Polygon PostGIS type: MULTIPOLYGON[2] Failed in pgui_exec(): ERROR: invalid byte sequence for encoding "UTF8": 0xe3 0xa1 0x74 Shapefile import failed. – majus251 Apr 25 '17 at 9:01
  • Have you tried one of the other encodings described on that page: gnu.org/software/libiconv. Sometimes there is a cpg file included that might give some clue. Newer shp2pgsql automatically reads the file as I recall. We may not have that logic in shp2pgsql-gui. – LR1234567 Apr 25 '17 at 14:06
0

What worked for me was putting the files in my C or D disk. I guess it just for avoiding directories with strange caracteres as names or blank spaces.

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.