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-postgis
Then 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-postgis
Next 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_postgis2
Ok 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 training
Good – 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!
相关推荐
Installing STLinux on Ubuntu
面是我在Ubuntu6.06 LTS 下源码编译安装samba主要安装过程,本人第一次用Ubuntu,刚装上去时候,没有gcc编译环境。郁闷了半天。找出这一过程发了不少的时间。可能还有些不妥,不过我经过这样的安装达到了向windows共享...
Installing Activ Test on Your PC
Installing Your Driver on Windows Millennium INF File Guide
OpenERP Installing Ubuntu9.04
installing oracle9i on redhat linux.rar 分布讲述在redhat上安装oracle9i的全过程和注意事项!
Installing RAC on AIX
Installing MIUI on Meizu MX2
\Installing RAC on AIX 001.pdf
Installing Oracle 10G On Linux
Installing Ubuntu—Getting started 11 Finishing Installation 16 2 The Ubuntu Desktop 19 Understanding the Ubuntu desktop 19 Unity 19 The Launcher 21 The Dash 21 Workspaces 24 Managing windows 24 Unity...
quantum espresso 视频可以认真学习 进行入门,非常不错的材料 给大家进行分享,值得拥有
Installing Oracle Database 11g on Linux
Time for action – installing Android SDK and NDK on Ubuntu Setting up the Eclipse development environment Time for action – installing Eclipse Emulating Android Time for action – creating an ...
Requirements For Installing Oracle10gR2 On RHEL 5&OEL 5 (x86_64)
One way of doing it is using mod_php5 Apache module to serve PHP 5.3 applications, while running PHP 5.2 applications using fastcgi module. Under Ubuntu 12.04 this can be achieved by installing ...
The Ubuntu Server Guide contains information on how to install and configure various server applications on your Ubuntu system to fit your ...installing Ubuntu, refer to the Ubuntu Installation Guide.
Installing Ubuntu 14.04 & ROS & TurtleBot 06-29-2016 个人小结,关于Ubuntu和ROS的安装。
oracle完整安装文档,for linux
For a oracle enviroment without SAP, the backup can also done by brtools.