postgres-SQL学习笔记:如何将DAT文件传输到PG中

今天成功实现了将DAT文件拷贝到空间数据库中;


http://gis.stackexchange.com/questions/39238/how-to-import-shp2pgsql


1 Answer
activeoldestvotes
up vote
9
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..

shareimprove this answer
answered Nov 3 '12 at 17:18

Haziq
795519
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

你可能感兴趣的:(postgres)