TileServer » History » Version 3
Philippe May, 13/10/2018 12:43
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 | 3 | Philippe May | h3. From openmaptiles (outdated) |
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 | 3 | Philippe May | h3. Directly from osm |
26 | 3 | Philippe May | |
27 | 3 | Philippe May | Download and convert to MBTiles: |
28 | 3 | Philippe May | |
29 | 3 | Philippe May | <pre> |
30 | 3 | Philippe May | cd /usr/local |
31 | 3 | Philippe May | curl -O http://download.openstreetmap.fr/extracts/asia/india/tamil_nadu.osm.pbf |
32 | 3 | Philippe May | ogr2ogr -s_srs EPSG:4326 -t_srs EPSG:3857 -f MBTILES asia_india_tn.mbtiles tamil_nadu.osm.pbf |
33 | 3 | Philippe May | </pre> |
34 | 3 | Philippe May | |
35 | 1 | Philippe May | h2. Service |
36 | 1 | Philippe May | |
37 | 1 | Philippe May | A systemd service configuration file, in @/etc/systemd/system/tileserver-gl-light.service@: |
38 | 1 | Philippe May | |
39 | 1 | Philippe May | <pre> |
40 | 1 | Philippe May | [Service] |
41 | 3 | Philippe May | ExecStart=/usr/local/node-v6.14.3-linux-x64/bin/node /usr/lib/node_modules/tileserver-gl-light/src/main.js --cors true -c /etc/tileserver/config-tn.json |
42 | 1 | Philippe May | Restart=always |
43 | 1 | Philippe May | User=www-data |
44 | 1 | Philippe May | Group=www-data |
45 | 1 | Philippe May | Environment=NODE_ENV=production |
46 | 1 | Philippe May | |
47 | 1 | Philippe May | [Install] |
48 | 1 | Philippe May | WantedBy=multi-user.target |
49 | 1 | Philippe May | </pre> |
50 | 1 | Philippe May | |
51 | 1 | Philippe May | h2. Configuration |
52 | 1 | Philippe May | |
53 | 1 | Philippe May | Eg, in @/etc/tileserver/conf.json@: |
54 | 1 | Philippe May | |
55 | 1 | Philippe May | <pre> |
56 | 1 | Philippe May | { |
57 | 1 | Philippe May | "options": { |
58 | 1 | Philippe May | "paths": { |
59 | 1 | Philippe May | "root": "", |
60 | 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" |
61 | 1 | Philippe May | }, |
62 | 1 | Philippe May | "domains": [ |
63 | 1 | Philippe May | "gis.auroville.org.in" |
64 | 1 | Philippe May | ], |
65 | 1 | Philippe May | "styles": {} |
66 | 1 | Philippe May | }, |
67 | 1 | Philippe May | "data": { |
68 | 1 | Philippe May | "india-vector": { |
69 | 3 | Philippe May | "mbtiles": "/usr/local/asia_india_tn.mbtiles" |
70 | 1 | Philippe May | } |
71 | 1 | Philippe May | } |
72 | 1 | Philippe May | } |
73 | 1 | Philippe May | </pre> |
74 | 1 | Philippe May | |
75 | 1 | Philippe May | h2. Run the service |
76 | 1 | Philippe May | |
77 | 1 | Philippe May | <pre> |
78 | 1 | Philippe May | systemctl enable --now tileserver-gl-light.service |
79 | 1 | Philippe May | </pre> |
80 | 1 | Philippe May | |
81 | 1 | Philippe May | h4. nginx proxy |
82 | 1 | Philippe May | |
83 | 1 | Philippe May | In order the mbtiles to be served by tileserver, add in the nginx conf (adjust eventually): |
84 | 1 | Philippe May | |
85 | 1 | Philippe May | <pre> |
86 | 1 | Philippe May | location /tiles/ { |
87 | 1 | Philippe May | proxy_pass http://127.0.0.1:8080/; |
88 | 1 | Philippe May | } |
89 | 1 | Philippe May | </pre> |