postgresql postgis creat table and exp imp data

 

creat table and AddGeometryColumn
--drop table feature_hotarea_lzd;

create table
"feature_hotarea_lzd"(
gid serial PRIMARY KEY,
"areaid" character varying(32),
"mc" character varying(32),
"startscalelevel" character varying(20),
"endscalelevel" character varying(20)
)
select AddGeometryColumn(
'','feature_hotarea_lzd','the_geom','4326','MULTIPOLYGON',2);

 

 

 

在SQL语句中,用以下的方式可以使用WKT格式定义几何对象:

POINT(0 0) ——点

LINESTRING(0 0,1 1,1 2) ——线

POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1)) ——面

MULTIPOINT(0 0,1 2) ——多点

MULTILINESTRING((0 0,1 1,1 2),(2 3,3 2,5 4)) ——多线

MULTIPOLYGON(((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1)), ((-1 -1,-1 -2,-2 -2,-2 -1,-1 -1))) ——多面

GEOMETRYCOLLECTION(POINT(2 3),LINESTRING((2 3,3 4))) ——几何集合

 

shp to sql :

cd E:\Program Files\PostgreSQL\8.4\bin

shp2pgsql -s "4326" -W "GBK" E:\shp\shp\村_point.shp PMS_GEO_MAP_CUN >E:\chinamap\cun.sql

表名:pms_geo_map_cun

sql to postgis:

psql -d postgis -f E:\chinamap\cun.sql postgres

库名:postgis 用户密码:postgres

posted @ 2010-07-20 11:27  spencer.IQ  阅读(292)  评论(0)    收藏  举报