Changes between Version 3 and Version 4 of UsersWikiPostGIS20Ubuntu1110src
- Timestamp:
- 04/03/12 00:54:25 (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
UsersWikiPostGIS20Ubuntu1110src
v3 v4 6 6 Install prerequisite packages using: 7 7 {{{ 8 sudo apt-get install build-essential postgresql-9.1 postgresql-server-dev-9.1 libxml2-dev proj libjson0-dev 8 sudo apt-get install build-essential postgresql-9.1 postgresql-server-dev-9.1 libxml2-dev proj libjson0-dev xsltproc docbook-xsl docbook-mathml 9 9 }}} 10 10 11 Optional package for raster support :11 Optional package for raster support (this is required if you want to build the PostgreSQL extensions): 12 12 {{{ 13 13 sudo apt-get install libgdal-dev 14 14 }}} 15 16 Optional packages for testing PostGIS:17 {{{18 sudo apt-get install libcunit1-dev19 }}}20 Optional packages for building documentation:21 {{{22 sudo apt-get install xsltproc docbook-xsl docbook-mathml imagemagick23 }}}24 (for building PDF documentation, add `dblatex`, but expect a large download)25 15 26 16 === Build GEOS 3.3.x === … … 29 19 There are multiple ways to build GEOS, but this is the simplest: 30 20 {{{ 31 wget http://download.osgeo.org/geos/geos-3.3. 2.tar.bz232 tar xvfj geos-3.3. 2.tar.bz233 cd geos-3.3. 221 wget http://download.osgeo.org/geos/geos-3.3.3.tar.bz2 22 tar xvfj geos-3.3.3.tar.bz2 23 cd geos-3.3.3 34 24 ./configure 35 25 make … … 40 30 == Build PostGIS == 41 31 {{{ 42 wget http://postgis.refractions.net/download/postgis-2.0.0 beta4.tar.gz43 tar xfvz postgis-2.0.0 beta4.tar.gz44 cd postgis-2.0.0 beta432 wget http://postgis.refractions.net/download/postgis-2.0.0rc2.tar.gz 33 tar xfvz postgis-2.0.0rc2.tar.gz 34 cd postgis-2.0.0rc2 45 35 }}} 46 PostGIS 2.0 can be configured to disable topology or raster extensions, using the configure flags `--without-raster` and `--without-topology`. The default is to build both extensions: 36 37 PostGIS 2.0 can be configured to disable topology or raster components, using the configure flags `--without-raster` and/or `--without-topology`. The default is to build both extensions. Note that raster is required for the extension installation method for PostgreSQL. 47 38 {{{ 48 39 ./configure … … 60 51 }}} 61 52 62 == Template == 63 Complete a post-install by creating a template, which can be re-used for creating multiple spatially-enabled databases. Or if you just want to make one spatially enabled database, you can modify the commands for your needs. 53 == Spatially enabling a database == 54 With PostgreSQL 9.1, there are two methods to add PostGIS functionality to a database: using extensions, or using enabler scripts. 55 56 === PostGIS Extension for PostgreSQL === 57 Spatially enabling a database using extensions is a new feature of PostgreSQL 9.1. 58 59 Connect to your database using pgAdmin or psql, and run the following commands. To add postgis with raster support: 60 {{{ 61 CREATE EXTENSION postgis; 62 }}} 63 64 To add topology support, a second extension can be created on the database: 65 {{{ 66 CREATE EXTENSION postgis_topology; 67 }}} 68 69 == Enabler Scripts / Template == 70 71 Enabler scripts can be used to either build a template, or directly spatially enable a database. This method is older than the extension method, but is required if the raster support is not built. 72 73 The following example creates a template, which can be re-used for creating multiple spatially-enabled databases. Or if you just want to make one spatially enabled database, you can modify the commands for your needs. 74 75 PostGIS: 64 76 {{{ 65 77 sudo -u postgres createdb template_postgis … … 69 81 }}} 70 82 71 === Enable raster extension === 72 Adding on to `template_postgis`: 83 with raster support: 73 84 {{{ 74 85 sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.0/rtpostgis.sql … … 76 87 }}} 77 88 78 === Enable topology extension === 79 Adding on to `template_postgis`: 89 with topology support: 80 90 {{{ 81 91 sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-2.0/topology.sql