Welcome 微信登录

首页 / 操作系统 / Linux / 在Ubuntu 12.04上部署PostGIS 2.1

PostGIS 2.0已经发布了,挺激动人心的。在12.04中集成了PostGIS 1.5.4,如果想用到一些新的特性,就不得不做出升级的选择。我们采用sharpie项目组的发布包进行部署。首先,卸载掉原有的postgis和postgresql-9.1-postgis包。sudo dpkg --purge postgis postgresql-9.1-postgis
然后,添加相应的repository并安装PostGIS.sudo apt-add-repository ppa:sharpie/for-science  # To get GEOS 3.3.2
sudo apt-add-repository ppa:sharpie/postgis-nightly
sudo apt-get update
sudo apt-get install postgresql-9.1-postgis接下来,创建模板库createdb -E UTF8 template_postgis
createlang -d template_postgis plpgsql
psql -d postgres -c "UPDATE pg_database SET datistemplate="true" WHERE datname="template_postgis""
psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.1/postgis.sqlpsql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.1/spatial_ref_sys.sqlpsql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.1/postgis_comments.sqlpsql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.1/rtpostgis.sqlpsql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.1/raster_comments.sqlpsql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.1/topology.sqlpsql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.1/topology_comments.sqlpsql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.1/legacy.sql
最后,利用模板创建数据库就可以了creatdb mydb -T template_postgis 
参考内容:1.部署内容参考 其原文内容如下PostGIS 2.0 is out and the awesomness continues! You can install PostGIS 2.0 on Ubuntu using packages which is exactly what I am going to show you here. Read on for details on how to get up and running and do your first simple raster analysis!
Note: You should make good backups first!Before we begin, you should uninstall your existing postgis packages:sudo dpkg --purge postgis postgresql-9.1-postgisThen add a new repository and install PostGIS from there (based on this post):sudo apt-add-repository ppa:sharpie/for-science  # To get GEOS 3.3.2
sudo apt-add-repository ppa:sharpie/postgis-nightly
sudo apt-get update
sudo apt-get install postgresql-9.1-postgisNext we should create a new template database (optional but recommended).createdb -E UTF8 template_postgis2
createlang -d template_postgis2 plpgsql
psql -d postgres -c "UPDATE pg_database SET datistemplate="true" WHERE datname="template_postgis2""
psql -d template_postgis2 -f /usr/share/postgresql/9.1/contrib/postgis-2.0/postgis.sql
psql -d template_postgis2 -f /usr/share/postgresql/9.1/contrib/postgis-2.0/spatial_ref_sys.sql
psql -d template_postgis2 -f /usr/share/postgresql/9.1/contrib/postgis-2.0/rtpostgis.sql
psql -d template_postgis2 -c "GRANT ALL ON geometry_columns TO PUBLIC;"
psql -d template_postgis2 -c "GRANT ALL ON geography_columns TO PUBLIC;"
psql -d template_postgis2 -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"
createdb training -T template_postgis2Ok now we can load a raster (see sample data download below):raster2pgsql -s 4326 srtm_4326.tif | psql training
shp2pgsql -s 4326 -d -g geom -I places.shp places| psql trainingGood – now our spatial database is ready to use – and has raster support! Here is a nice example of what you can do. The query looks up the altitude from the SRTM raster for each place listed using the ST_Value function:select ST_Value(rast, geom, true) from places, srtm_4326;It should produce something like this:Further reading: A really good place to start is the Boston GIS cheatsheets – I am really looking forward to exploring all the new features that are available in PostGIS 2.0, thanks to all those involved in building it!Sample data for the example listed---------------------------------------------------------------------------2.创建空间数据库的说明 请参考 http://postgis.refractions.net/documentation/manual-2.0/postgis_installation.html#id2801293Ubuntu Tweak清理Ubuntu后不能进入桌面解决在 Ubuntu 上安装 LaTeX相关资讯      Ubuntu 12.04  PostGIS 
  • Ubuntu 12.04.5 LTS 发布,赶快升  (08/09/2014 07:22:42)
  • PostGIS 2.0.6 发布,PG 的空间数  (05/20/2014 09:46:02)
  • Ubuntu 12.04 LTS安装后3件必须做  (04/13/2014 08:17:09)
  • Ubuntu 12.04.5 将在8月7号发布  (07/15/2014 16:37:58)
  • 网络电视软件 TV-Maxe 0.09 发布附  (04/20/2014 20:33:17)
  • Ubuntu 12.04和14.04两大版本性能  (02/14/2014 12:03:01)
本文评论 查看全部评论 (0)
表情: 姓名: 字数