Chinaunix首页 | 论坛 | 博客
  • 博客访问: 629579
  • 博文数量: 149
  • 博客积分: 3901
  • 博客等级: 中校
  • 技术积分: 1558
  • 用 户 组: 普通用户
  • 注册时间: 2009-02-16 14:33
文章分类

全部博文(149)

文章存档

2014年(2)

2013年(10)

2012年(32)

2011年(21)

2010年(84)

分类: 服务器与存储

2012-03-21 21:32:43

 
 
开源空间运算 opengis  相关产品 :
  
 
 
搭建 postgis + postgresql   
 
  需要安装
      postgresql  
      proj           
      geos           
      postgis       
 
  $$在搭建时 postgis 编译时 ,参数 新版本 有变化
            ./configure 
                  --with-pgconfig=/usr/local/pgsql/bin/pg_config  
                  --with-projdir=/usr/local/share/proj   
                  --with-geosconfig=/usr/local/bin/geos-config
 
启动 和  mysql 一样使用 非 root 帐号
[postgres@hpc] $ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
[postgres@hpc] $ /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data
[postgres@hpc] $ /usr/local/pgsql/bin/createdb testgisdb
 
#注入 postgis functions
$postgis.sql  文件在 postgis 安装目录下有
[postgres@hpc] $ /usr/local/pgsql/bin/psql -f postgis/postgis.sql  -d testgisdb
 
 
使用参考:
     #官方文档
 
 
这 用个 实用小例 :
$> su postgres
$> /usr/local/pgsql/bin/psql  -d test
testgisdb =# create table test1 (myID int4, pt geometry, myName varchar );
testgisdb =# alter table test1 add primary key (myID);
testgisdb =# insert into test1 values (1, 'POINT(0 0)', 'beijing' );
testgisdb =# insert into test1 values (2, 'POINT(31.5 60.87)', 'shanghai' );
testgisdb =# insert into test1 values (3, 'POINT(10.77 85.902)', 'tianjin' );
testgisdb =# select myname,AsText(pt) from test1;
 
  myname  |       astext        
----------+---------------------
 beijing  | POINT(0 0)
 shanghai | POINT(31.5 60.87)
 tianjin  | POINT(10.77 85.902)
 
 
#这里 你们应该懂的!!
testgisdb=#  select  myname,AsText(pt) from test1 where ST_within( pt, 'POLYGON((0 0,0 70,100 70,100 0,0 0))' ) ;
  myname  |      astext       
----------+-------------------
 shanghai | POINT(31.5 60.87)
阅读(1123) | 评论(0) | 转发(0) |
0

上一篇:vim 初级小结

下一篇:git 分支使用(转)

给主人留下些什么吧!~~