TileServer » History » Version 1
    
    Version 1/22
     - 
    Next » - 
    Current version
    
    Philippe May, 12/10/2018 15:50 
    
    
TileServer¶
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).
yarn global add tileserver-gl-light
Download the mbtiles¶
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)
Service¶
A systemd service configuration file, in /etc/systemd/system/tileserver-gl-light.service:
[Service] ExecStart=/usr/bin/node /usr/lib/node_modules/tileserver-gl-light/src/main.js --cors true -c /etc/tileserver/conf.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/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/2017-07-03_asia_india.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/;
    }