Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 postgresql.org/docs/current/static/multibyte.html

Is my command wrong ??

share|improve this question
add comment

1 Answer

up vote 5 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
1  
Hmm.. Have you correctly installed the PostGIS extension to the postgres database? If you haven't: maybe this can help.. –  Haziq 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.. –  Haziq 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? –  Haziq 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 ;) –  Haziq Nov 4 '12 at 16:56
add comment

Your Answer

 
discard

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.