makinacorpus/osm-mirror

Name: osm-mirror

Owner: Makina Corpus

Description: OSM mirror - full stack

Created: 2013-12-18 09:34:31.0

Updated: 2017-09-27 14:41:45.0

Pushed: 2017-02-15 22:02:44.0

Homepage: null

Size: 1316

Language: Shell

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

OpenStreetMap Mirror

Up-to-date OpenStreetMap tile server, with various map styles.

Main Purpose

Preview

Install

Requirements

Just run the following commands :

curl https://raw.github.com/makinacorpus/osm-mirror/master/install.sh > install.sh
chmod +x install.sh
sudo ./install.sh 2>&1 | tee install.log

That's it ! Access your server URL.

You will be prompted for an extent (xmin,ymin,xmax,ymax). The default one is the city of Albi. Use the OpenStreetMap extent tool for help.

A lot of data will be downloaded (Approx. 1Go).

A planned task will be setup to overwrite the whole database with up-to-date OpenStreetMap data, every month (root crontab).

Use the tiles in Leaflet
var map = L.map('map').setView([43.92751, 2.14760], 14);

L.tileLayer('http://SERVER/STYLE/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
Use the tiles in OpenLayers 3
var map = new ol.Map({
    target: 'map',
    layers: [
        new ol.layer.Tile({
            attributions: [new ol.Attribution({
              html: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
            })],
            source: new ol.source.XYZ({
                url: 'http://SERVER/STYLE/{z}/{y}/{x}.png'
            })
        })
    ],
    view: new ol.View2D({
      center: ol.proj.transform([43.92751, 2.14760], 'EPSG:4326', 'EPSG:3857'),
      zoom: 14
    })
});
Change extent

Edit the EXTENT value in /etc/default/openstreetmap-conf.

Update the configuration :

sudo ./update-conf.sh

Refresh the data on the new extent :

sudo ./update-data.sh
Generate GeoTiff rasters

Generate a raster file on the extent at the specified scale :

./render-raster.sh osm osm-25000

Will render the style osm into osm-25000.tif, on the extent stored in configuration file at the default scale (1:25000).

Extent and scale can be specified as options :

./render-raster.sh osm osm-7000 --scale=7000 --extent=-180 90 180 -90
Add new style from TileMill

Create a style with Tilemill, export it as Mapnik XML ( osm2pgsql flavor ).

Post-process the XML file :

Copy the whole folder into styles/. Name the .xml file with the same name as the folder.

Update the configuration :

sudo ./update-conf.sh
Known limitations
Credits
Authors

Makina Corpus


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.