Let there be PostGIS

postgis-logo

To prepare for the TileMill Crash Course I needed to install a GIS, (in addition to Oracle Spatial and Graph which I previously installed). PostGIS was an easy choice for Ubuntu 12.04 since it is available in the Ubuntu Software Center.

First, I installed PostgreSQL and pgAdmin III.

pgadmin

Initially, I install PostGIS from the Ubuntu Software Center, but I was unable to create the PostGIS or postgis_topology extension.  In the end, I removed it and then followed the instructions found in How to install PostGIS 2.0 on Ubuntu 12.04 LTS (precise) from source. Following those instructions you will do the following:

  1. Install prerequisites, including gdal, if you haven’t already installed it.
  2. Build GEOS 3.3.x from source.
  3. Build PostGIS from source.
  4. Spatially enable your database.

I created a database and added the postgis extensions to it, and then used the function postGIS_full_version() to verify the extension.


$ createdb exploringspatial
$ psql -U postgres exploringspatial
Password for user postgres:
psql (9.1.9)
Type "help" for help.
exploringspatial=# CREATE EXTENSION postgis;
CREATE EXTENSION
exploringspatial=# CREATE EXTENSION postgis_topology;
CREATE EXTENSION
exploringspatial=# SELECT postGIS_full_version();

————————————————————————————————————————————————————————–
POSTGIS=”2.0.3 r11128″ GEOS=”3.3.8-CAPI-1.7.8″ PROJ=”Rel. 4.8.0, 6 March 2012″ GDAL=”GDAL 1.11dev, released 2013/04/13″ LIBXML=”2.8.0″ LIBJSON=”UNKNOWN” TOPOLOGY RASTER
(1 row)
Finally, launch the Shape File to PostGIS Importer GUI to verify it is installed:
$ sudo xhost +localhost
localhost being added to access control list
$ shp2pgsql-gui &
The Shape File to PostGIS Importer GUI launched as expected, so now I can get back to the TileMill crash course:

shp2pgsql

Next, I’ll follow the Tilemill crash course and play with heat maps.

Advertisements

One thought on “Let there be PostGIS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s