理解值类型和引用类型
2009-08-14 16:23
218 查看
Installing PostGIS 2.0 on ubuntu
首先,卸载掉原有的postgis和postgresql-9.1-postgis,不然你就用1.5版好了~
1
sudo dpkg --purge postgis postgresql-9.1-postgis
然后,添加相应的repository 并安装PostGIS
1
sudo apt-add-repository ppa:sharpie/for-science # To get GEOS 3.3.2
2
sudo apt-add-repository ppa:sharpie/postgis-nightly
3
sudo apt-get update
4
sudo apt-get install postgresql-9.1-postgis
接着生成postgis模板库
1
sudo su postgres
2
createdb postgis_template
1
psql -d postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
2
psql -d postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql
最后,修改一下用户密码
1
psql
2
ALTER USER postgres WITH PASSWORD '123456';
OK了,去体验 postgis强大的空间能力吧!
http://linfiniti.com/2012/05/installing-postgis-2-0-on-ubuntu/
Posted May 11, 2012 by Tim Sutton & filed under Postgres & PostGIS, QGIS.
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!
Sample data for the example listed
相关文章推荐
- java 引用类型 和 基本类型的理解
- 对于引用类型和强制类型转换的理解
- 读《.NET(C#):理解值类型/引用类型,装箱/拆箱,Object类》 有感,小白类文
- 对C# 中堆栈,堆,值类型,引用类型的理解
- C# OOP之五 深入理解值类型和引用类型
- 彻底理解C#中值类型和引用类型的区别
- 非const引用参数传入不同类型编译不过的理解(拒绝将临时对象绑定为非const的引用的形参是有道理的)
- .net中值类型、引用类型理解的c#代码示例
- 深入理解Java引用类型
- 理解C#值类型与引用类型(收藏)
- 深入理解Java 8 Lambda(语言篇——lambda,方法引用,目标类型和默认方法)
- 理解C#值类型与引用类型
- 深入理解Java虚拟机笔记---引用类型和对象是否死亡
- C#中值类型与引用类型通俗理解
- 再也不用担心javascript的this---从代码去理解(第二篇)---引用类型
- 用类名做方法的返回值类型 在学习Java的初始阶段,很多同学使用基本数据类型定义变量和引用类型定义变量以及使用类名做方法的返回值类型常常不知所以。今天我以自己的解读方式和个人的理解作一个简单的解释,和
- 理解C#值类型和引用类型
- javascript 引用类型 - 基本包装类型(深入理解基本包装类型和基本类型的区别)
- 基本类型和引用类型值传递的理解
- C#之理解值类型和引用类型