PostGIS之SHP数据的导入

注意:int等类型的值如果为null,则会赋值为0
  • shp转换成sql文件

CD “C:\Program Files (x86)\PostgreSQL\9.2\bin”​​ 

shp2pgsql -d -g “shape” -s 4326 -W “GBK” D:\Data\bou2_4m\bou2_4l.shp tablename > c:\tablename.sql

​-d:删除然后创建 

-g:空间字段的名称 

-s:空间参考

-W:字符编码

  • SQL 入库:

CD “C:\Program Files (x86)\PostgreSQL\9.2\bin”

psql -h localhost -p 5432 -U postgres -w -d “DPRS” -f “c:\tablename.sql”

-h : IP地址 

-p : 端口号 

-U : 用户名 

-w : 不输入密码 

-d : 数据库名称 

-f : 后面跟需要执行的sql文件

转载自:https://blog.csdn.net/atzhangzt/article/details/46683353

You may also like...