Geo-Stack

geo-stack success

At the most recent NACIS conference Eric Theise gave a workshop on implementing an open-source Geo-Web-Stack, or a combination of software that allows for rendering custom map tiles from OpenStreetMap data which then can be used to create an web-map application. I had a chance to look through his slides for the workshop on my own and managed to follow all the steps to get the stack up and running.

The steps were as follows:

  1. Install Homebrew, a package manager for Mac OS that lets you download software from Terminal.
    (Luckily I already had this installed.)
  2. Using Homebrew install the dependency software: Postgres, PostGIS, osm2pgsql, GDAL, Node, etc.
    (this took a little work but I managed to get them installed successfully.)
  3. Install TileMill from MapBox
    (already installed and am familiar with using it.)
  4. Download a city extract from OpenStreetMap in PBL format.
  5. Create a database in Postgres using the createdb command in Terminal to store the OSM PBL data in.
  6. Enable the database to be spatially aware by adding the PostGIS extension as well as the hstore extension to keep OSM’s tag data which are stored as key : value pairs. This helps with querying the data later.
  7. Import the OSM PBL data into the Postgres database using osm2pgsql.
  8. In TileMill create layers using SQL queries to select the appropriate data from Postgres.
  9. Use CartoCSS in TileMill to style the layers appropriately at various zoom levels.
  10. Export the tiles as an mbtiles file for rendering.
  11. Using the Node TileStream host the tiles on a local server.
  12. Run the Node Express Framework to connect to the tile layer via Leaflet JS.
  13. Create a GeoJSON layer from a Postgres query on OpenStreetMap points of interest.
  14. Display the whole thing and provide pop-ups for the markers using Leaflet.

I was pretty excited to get this up and running to say the least and am definitely looking forward to using it in one of my future projects.