SHP导入POSTGIS数据库
POSTGIS数据库导出SHP:生成shp数据 //windows导出乱码解决办法:在环境变量中设置 PGCLIENTENCODING=GBK或PGCLIENTENCODING=GB18030,然后执行pgsql2shp,导出的shape文件中,属性数据编码正确是GBK的,没有显示乱码。
shp2pgsql -s 4326 -W GBK CheckWell_point.shp public.CheckWell_point>CheckWell_point.sql
shp2pgsql -s 4326 -W GBK CheckWell_point.shp public.CheckWell_point psql -U postgres -w -d jwsz
@echo 导入 shp2pgsql -s 4326 -a -W GBK CheckWell_point.shp public.CheckWell_point>CheckWell_point.sql psql -U postgres -w -d jwsz -f CheckWell_point.sql -e @echo 导出 pgsql2shp.exe -f CheckWell_point -P 123456 -u postgres jwsz public.CheckWell_point
@echo 删除并更新 点数据 shp2pgsql -s 4326 -d -W GBK CheckWell_point.shp public.CheckWell_point|psql -U postgres -w -d jwsz @echo 尝试创建 线数据 shp2pgsql -s 4326 -p -W GBK CableLine_polyline.shp public.CableLine_polyline|psql -U postgres -w -d jwsz @echo 数据追加 线数据 shp2pgsql -s 4326 -a -W GBK CableLine_polyline.shp public.CableLine_polyline|psql -U postgres -w -d jwsz
@echo 尝试创建 面数据 shp2pgsql -s 4326 -p -W GBK Bridge_region.shp public.Bridge_region|psql -U postgres -w -d jwsz @echo 数据追加 面数据 shp2pgsql -s 4326 -a -W GBK Bridge_region.shp public.Bridge_region|psql -U postgres -w -d jwsz pause
shp2pgsql命令相关参数
pgsql2shp命令相关参数
RCSID: $Id: pgsql2shp.c 5451 2010-03-22 19:38:40Z pramsey $ RELEASE: 1.5 USE_GEOS=1 USE_PROJ=1 USE_STATS=1 USAGE: pgsql2shp [<options>] <database> [<schema>.]<table> pgsql2shp [<options>] <database> <query>
OPTIONS: -f <filename> Use this option to specify the name of the file to create. -h <host> Allows you to specify connection to a database on a machine other than the default. -p <port> Allows you to specify a database port other than the default. -P <password> Connect to the database with the specified password. -u <user> Connect to the database as the specified user. -g <geometry_column> Specify the geometry column to be exported. -b Use a binary cursor. -r Raw mode. Do not assume table has been created by the loader. This would not unescape attribute names and will not skip the 'gid' attribute. -k Keep postgresql identifiers case. -? Display this help screen.