Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to import shape file into PostGIS. There is 1 database postgres in it but no table added yet.

I am using this command:

shp2pgsql -I -s 4326 districts.shp districts | psql -d postgres -U postgres 

and it's giving me some error:

Unable to convert data value to UTF-8 (iconv reports "Invalid or incomplete multibyte or wide character"). Current encoding is "UTF-8". Try "LATIN1" (Western European), or one of the values described at

Is my command wrong ??

share|improve this question
thanks that what so great for me! – Julio C Rivera Jun 11 '14 at 7:21
up vote 12 down vote accepted

Have you tried -W "latin1" flag? Sometimes the default encoding (UTF-8) doesn't work well. Maybe you'll have better luck with latin1 encoding:

shp2pgsql -I -s 4326 -W "latin1" districts.shp districts | psql -d postgres -U postgres

There's a useful cheat-sheet available here.

Hope it helps..

share|improve this answer
Hmm.. Have you correctly installed the PostGIS extension to the postgres database? If you haven't: maybe this can help.. – user8723 Nov 3 '12 at 17:45
Usually if make install worked, you can move on to next process (make check is a step prior to make install).. If you can connect to your database via psql/pgadmin3 - that means your installation is a success. Can you move on to the "Create a spatial database" step? I recommend using the EXTENSIONS method.. – user8723 Nov 4 '12 at 15:55
Dude, this has strayed too far from your original question, haha.. It's a little hard to help you here when there's are a lot of variables at play: which version of PostgreSQL are you using?; on what kind of system?; and which version of PostGIS are you trying to install? It seems like it didn't recognize the "CREATE EXTENSION" syntax.. Does typing only: psql -d geocoding -U postgres gets you into the geocoding database successfully? – user8723 Nov 4 '12 at 16:50
My bad. Then you should follow the 2.5. Create a spatially-enabled database on PostgreSQL lower than 9.1 section.. If you still run into problems I'd suggest that you open a new question - so you can get better answers ;) – user8723 Nov 4 '12 at 16:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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