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.
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:
- Install prerequisites, including gdal, if you haven’t already installed it.
- Build GEOS 3.3.x from source.
- Build PostGIS from source.
- 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:
Type "help" for help.
exploringspatial=# CREATE EXTENSION postgis;
exploringspatial=# CREATE EXTENSION postgis_topology;
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
Finally, launch the Shape File to PostGIS Importer GUI to verify it is installed:
The Shape File to PostGIS Importer GUI launched as expected, so now I can get back to the TileMill crash course:
$ sudo xhost +localhost
localhost being added to access control list
$ shp2pgsql-gui &
Next, I’ll follow the Tilemill crash course and play with heat maps.