THIS document is a work in progress.
There are several options but mainly three web map servers (WMS): Mapnik, GeoServer and MapServer. Simple visualization:
A) browser/client (leaflet, openlayers) | B) tile server (mod_tile, tile cache, tile stache, mapproxy, geowebcache) | C) map web service = WMS (MapServer, GeoServer, Mapnik) | D) Data storage (PostgreSQL, vector tiles) | E) OSM data (xml, pbf)
Comments
- for C => Mapnik can use TileMill to style to map
- leaflet can do tile layers (B) but also WMS (C)
- Nearly always you need PostgreSQL, but in rare cases you can avoid it via vector tiles.
- A common approach is to use apache2 with mod_tile. Serving the tiles from disc or creating the image via mapnik through renderd. But also nginx gets more popular. Tiledrawer has an old scripts also with mapnik and nginx.
- You can also use GeoServer with a cache in front. Often it only serves some feature layers.
- WFS = web feature service
- MWS = map web service
Installation of PostgreSQL, Mapnik, mod_tile, renderd
PostgreSQL
First of all you need the OSM data in a PostgreSQL database via osm2psql import – an easy description is here. For a faster import you can try imposm instead of the more common osm2psql.
Install the Rest
Although nginx would be preferred I did not find a out of the box working solution for it. So you need to use apache2 and mod_tile: a simple installation. Also there is an older article which I did not try. There is also a good presentation with some useful information.
sudo apt-get install python-software-properties sudo add-apt-repository ppa:kakrueger/openstreetmap sudo apt-get update # now install mod_tile and renderd with the default style sudo apt-get install libapache2-mod-tile sudo -u postgres osm2pgsql --slim -C 1500 --number-processes 4 /tmp/europe_germany_berlin.pbf sudo touch /var/lib/mod_tile/planet-import-complete sudo /etc/init.d/renderd restart # optionally pre-generate some tiles for faster rendering - see "How do I pre-render tiles ?" # difference to generate_tiles.py and generate_tiles_multiprocess.py? go to http://localhost/osm/slippymap.html # to install mapnik-config do: sudo apt-get install libmapnik2-dev
Custom Styles
Here you can find newer style is constructed via CartoCSS
install carto either via just using TileMill or do
sudo apt-get install npm sudo npm install -g carto
TODO Get mapbox osm-bright working. This new style requires a specific version XY of mapnik which wasn’t found in my ubuntu version!?
cp configure.py.sample configure.py edit config name and path in configure.py ./make.py # backup /etc/mapnik-osm-data/osm.xml before doing: carto osm-bright/YourProject/project.mml > /etc/mapnik-osm-data/osm.xml # the osm.xml is used from mod_tile which uses renderd /etc/renderd.conf # mod_tile config is at: /etc/apache2/sites-available/tileserver_site # The tiles are here: /var/lib/mod_tile/default/
TODO To update the style you can try
sudo -u www-data touch /var/lib/mod_tile/planet-import-complete # important: do not delete 'default' itself sudo rm -R /var/lib/mod_tile/default/ # how to restart renderd properly? sudo service renderd restart
OLD STUFF:
Mapnik
For mapnik installation you’ll also need a web server like nginx or apache2. For nginx you can have a look into the script available here (clone the git repo):
Additionally you’ll need mod_tile and renderd or TileStache if you use nginx. To style the maps you can use TileMill.
GeoServer&GeoWebCache
Installation is a lot easier compared to Mapnik or MapServer. Only dependency is Java. Just grab the full zip of geo server and copy the war from web cache into webapps, then run ./bin/startup.sh
If you need mapbox tilemile styles for geoserver have a look into:
MapServer
http://dotrem.blogspot.ru/2013/06/mapservernginxfastcgi-on-ubuntu.html