TileServer » History » Version 9
« Previous -
Version 9/22
(diff) -
Next » -
Current version
Philippe May, 13/10/2018 12:59
TileServer¶
For updates, see also: #6907
TileServer-gl is a small node application that can serve vector tiles (mbtiles) for mapbox without the need for an external provider.
The maps Gisaf base layers (the definition file being located in gisaf-app/src/app/map/base_styles.ts
) in can be parametered such that a base layer is hosted locally (see the gisaf config file).
Install tileserver-gl-light¶
Unfortunately, it requires a much older version of node (6.x), that has been installed directly from http://nodejs.com .
export PATH=/usr/local/node-v6.14.3-linux-x64/bin:$PATH npm install -g tileserver-gl-light
Download the mbtiles¶
From openmaptiles (outdated versions only)¶
From: https://openmaptiles.com/downloads/planet/ , and store the relevant one on the server's filesystem (eg. /usr/local/2017-07-03_asia_india.mbtiles
)
Directly from osm (updated)¶
Prerequisite: gdal version 2.3.2 (Not available on Stretch: use Buster)
apt install gdal-bin
Download and convert to MBTiles:
cd /usr/local curl -O http://download.openstreetmap.fr/extracts/asia/india/tamil_nadu.osm.pbf ogr2ogr -s_srs EPSG:4326 -t_srs EPSG:3857 -a_srs EPSG:3857 -f MBTILES asia_india_tn.mbtiles tamil_nadu.osm.pbf -dsco MAXZOOM=14
Service¶
A systemd service configuration file, in /etc/systemd/system/tileserver-gl-light.service
:
[Service] ExecStart=/usr/local/node-v6.14.3-linux-x64/bin/node /usr/local/node-v6.14.3-linux-x64/lib/node_modules/tileserver-gl-light/src/main.js -c /etc/tileserver/config-tn.json Restart=always User=www-data Group=www-data Environment=NODE_ENV=production [Install] WantedBy=multi-user.target
Configuration¶
Eg, in /etc/tileserver/conf.json
:
{ "options": { "paths": { "root": "", "sprites": "/usr/local/node-v6.14.3-linux-x64/lib/node_modules/tileserver-gl-light/node_modules/tileserver-gl-styles/styles/osm-bright" }, "domains": [ "gis.auroville.org.in" ], "styles": {} }, "data": { "india-vector": { "mbtiles": "/usr/local/asia_india_tn.mbtiles" } } }
Run the service¶
systemctl enable --now tileserver-gl-light.service
nginx proxy¶
In order the mbtiles to be served by tileserver, add in the nginx conf (adjust eventually):
location /tiles/ { proxy_pass http://127.0.0.1:8080/; }