wiki:RenderingOsmDataUbuntu

Version 2 (modified by dmorissette, 13 years ago) ( diff )

--

Rendering OSM data with MapServer on Ubuntu 10.10

This page provides step by step instructions to setup a Ubuntu 10.10 LTS server from scratch to render OSM data with MapServer 6.x.

The following instructions assume that we start with a brand new Ubuntu 10.10 server with Apache installed but none of the MapServer related packages installed.

The setup will include:

Create work directory

  • All the steps that follow assume that the data and mapfiles will be installed in a directory called "osm-demo" in your home directory
  • Commands:
      mkdir ~/osm-demo
      cd ~/osm-demo/
    

Install UbuntuGIS MapServer and PostGIS packages

  • Relevant docs: http://trac.osgeo.org/ubuntugis/wiki/UbuntuGISRepository
  • At the time of this writing, the current version of MapServer is 6.0.1
  • Commands:
      sudo apt-get install python-software-properties
      sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
      sudo apt-get update
      sudo apt-get install cgi-mapserver mapserver-bin
    
      sudo apt-get install postgresql
      sudo apt-get install postgis postgresql-8.4-postgis
    
  • Install other non-GIS packages that will be required later on:
      sudo apt-get install mercurial subversion
      sudo apt-get install zip unzip
    

Download OSM data

  • You can download data for your region of interest from http://download.geofabrik.de/osm/. The rest of these instructions assume that we work with the data for the state of Alabama.
  • Commands:
      cd ~/osm-demo/
      wget http://download.geofabrik.de/osm/north-america/us/alabama.osm.pbf
    

Install imposm, using virtualenv

  • Relevant docs: http://imposm.org/docs/imposm/latest/install.html
  • Commands:
      cd ~/osm-demo/
      sudo apt-get install build-essential python-dev protobuf-compiler \
                          libprotobuf-dev libtokyocabinet-dev python-psycopg2 \
                          libgeos-c1
    
      sudo apt-get install python-virtualenv
      virtualenv venv
      venv/bin/pip install imposm
    
  • Install shapely speedups:
      sudo apt-get install libgeos-dev
      venv/bin/pip install https://github.com/olt/shapely_speedups/tarball/master
    

Create database

  • Relevant docs: http://imposm.org/docs/imposm/latest/tutorial.html
  • Commands:
      cd ~/osm-demo/
      venv/bin/imposm-psqldb > create-db.sh
      vi ./create-db.sh # cross check if all path are set
    ... edit the following lines:
    -------------------8<--------------
    psql -d osm -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql             # <- CHANGE THIS PATH
    psql -d osm -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql     # <- CHANGE THIS PATH
    ------------------->8--------------
    
      sudo su postgres
      sh ./create-db.sh
      /etc/init.d/postgresql-8.4 restart
      exit
    

Load data using imposm

Note: See TracWiki for help on using the wiki.