9

I want to import shapefile into PostGIS. There is one 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 ??

27

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..

  • 1
    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 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.