摘要: 今天结合网上的教程,主要内容有以下四点: 1、shapefile转为sql shp2pgsql -s 2385 E:\Line.shp NewLine >E:\Line.sql (-s坐标系代码,-W编码,NewLine表名)坐标系代码可以在spatial_r...
今天结合网上的教程,主要内容有以下四点:
1、shapefile转为sql
shp2pgsql -s 2385 E:\Line.shp NewLine >E:\Line.sql (-s坐标系代码,-W编码,NewLine表名)坐标系代码可以在spatial_ref_sys里查,也可以在网上查,网址如下 http://spatialreference.org/ref/epsg/
2、sql导入postgresql
psql -U postgres -d template_postgis -f E:\Line.sql (-U用户名,-d目标数据库,-f导入的SQL),不过表名好像不能大写
3、从postgresql导出shapefile
pgsql2shp -f e:\new.shp -u postgres template_postgis newline (-f导出的shp地址,-u用户名,数据库名,表名)
4、删除几何表(自动把geometry_columns表里的相关数据也删掉)
SELECT DropGeometryTable ('tablename')
今后打算重点研究一下里面的相关函数