TileServer » History » Version 8
Philippe May, 13/10/2018 12:57
1 | 1 | Philippe May | h1. TileServer |
---|---|---|---|
2 | 1 | Philippe May | |
3 | 3 | Philippe May | > For updates, see also: #6907 |
4 | 1 | Philippe May | |
5 | 1 | Philippe May | "TileServer-gl":https://github.com/klokantech/tileserver-gl is a small node application that can serve vector tiles (mbtiles) for mapbox without the need for an external provider. |
6 | 1 | Philippe May | |
7 | 1 | Philippe May | 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). |
8 | 1 | Philippe May | |
9 | 1 | Philippe May | h2. Install tileserver-gl-light |
10 | 1 | Philippe May | |
11 | 3 | Philippe May | Unfortunately, it requires a much older version of node (6.x), that has been installed directly from http://nodejs.com . |
12 | 1 | Philippe May | |
13 | 1 | Philippe May | <pre> |
14 | 2 | Philippe May | export PATH=/usr/local/node-v6.14.3-linux-x64/bin:$PATH |
15 | 2 | Philippe May | npm install -g tileserver-gl-light |
16 | 1 | Philippe May | </pre> |
17 | 1 | Philippe May | |
18 | 1 | Philippe May | |
19 | 1 | Philippe May | h2. Download the mbtiles |
20 | 1 | Philippe May | |
21 | 4 | Philippe May | h3. From openmaptiles (outdated versions only) |
22 | 3 | Philippe May | |
23 | 1 | Philippe May | 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@) |
24 | 1 | Philippe May | |
25 | 4 | Philippe May | h3. Directly from osm (updated) |
26 | 3 | Philippe May | |
27 | 8 | Philippe May | Prerequisite: |
28 | 8 | Philippe May | |
29 | 8 | Philippe May | <pre> |
30 | 8 | Philippe May | apt install gdal-bin |
31 | 8 | Philippe May | </pre> |
32 | 8 | Philippe May | |
33 | 3 | Philippe May | Download and convert to MBTiles: |
34 | 3 | Philippe May | |
35 | 3 | Philippe May | <pre> |
36 | 3 | Philippe May | cd /usr/local |
37 | 3 | Philippe May | curl -O http://download.openstreetmap.fr/extracts/asia/india/tamil_nadu.osm.pbf |
38 | 7 | Philippe May | 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 |
39 | 3 | Philippe May | </pre> |
40 | 3 | Philippe May | |
41 | 1 | Philippe May | h2. Service |
42 | 1 | Philippe May | |
43 | 1 | Philippe May | A systemd service configuration file, in @/etc/systemd/system/tileserver-gl-light.service@: |
44 | 1 | Philippe May | |
45 | 1 | Philippe May | <pre> |
46 | 1 | Philippe May | [Service] |
47 | 6 | Philippe May | 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 |
48 | 1 | Philippe May | Restart=always |
49 | 1 | Philippe May | User=www-data |
50 | 1 | Philippe May | Group=www-data |
51 | 1 | Philippe May | Environment=NODE_ENV=production |
52 | 1 | Philippe May | |
53 | 1 | Philippe May | [Install] |
54 | 1 | Philippe May | WantedBy=multi-user.target |
55 | 1 | Philippe May | </pre> |
56 | 1 | Philippe May | |
57 | 1 | Philippe May | h2. Configuration |
58 | 1 | Philippe May | |
59 | 1 | Philippe May | Eg, in @/etc/tileserver/conf.json@: |
60 | 1 | Philippe May | |
61 | 1 | Philippe May | <pre> |
62 | 1 | Philippe May | { |
63 | 1 | Philippe May | "options": { |
64 | 1 | Philippe May | "paths": { |
65 | 1 | Philippe May | "root": "", |
66 | 3 | Philippe May | "sprites": "/usr/local/node-v6.14.3-linux-x64/lib/node_modules/tileserver-gl-light/node_modules/tileserver-gl-styles/styles/osm-bright" |
67 | 1 | Philippe May | }, |
68 | 1 | Philippe May | "domains": [ |
69 | 1 | Philippe May | "gis.auroville.org.in" |
70 | 1 | Philippe May | ], |
71 | 1 | Philippe May | "styles": {} |
72 | 1 | Philippe May | }, |
73 | 1 | Philippe May | "data": { |
74 | 1 | Philippe May | "india-vector": { |
75 | 3 | Philippe May | "mbtiles": "/usr/local/asia_india_tn.mbtiles" |
76 | 1 | Philippe May | } |
77 | 1 | Philippe May | } |
78 | 1 | Philippe May | } |
79 | 1 | Philippe May | </pre> |
80 | 1 | Philippe May | |
81 | 1 | Philippe May | h2. Run the service |
82 | 1 | Philippe May | |
83 | 1 | Philippe May | <pre> |
84 | 1 | Philippe May | systemctl enable --now tileserver-gl-light.service |
85 | 1 | Philippe May | </pre> |
86 | 1 | Philippe May | |
87 | 1 | Philippe May | h4. nginx proxy |
88 | 1 | Philippe May | |
89 | 1 | Philippe May | In order the mbtiles to be served by tileserver, add in the nginx conf (adjust eventually): |
90 | 1 | Philippe May | |
91 | 1 | Philippe May | <pre> |
92 | 1 | Philippe May | location /tiles/ { |
93 | 1 | Philippe May | proxy_pass http://127.0.0.1:8080/; |
94 | 1 | Philippe May | } |
95 | 1 | Philippe May | </pre> |