Wiki » History » Version 29
Version 28 (Philippe May, 04/09/2018 17:12) → Version 29/46 (Philippe May, 12/10/2018 12:10)
h1. Software
Gisaf (for, eg, GIS Auroville Front-end) is a web application that is under development.
[[User manual]]
[[Server]]
[[Client]]
[[Stack]]
[[Mapbox]]
h2. Database
Gisaf uses a Postgis database.
h3. Creation
To create an appropriate database, run these commands:
<pre>
createuser avgis -P
createdb avgis -O avgis
psql avgis -c "CREATE EXTENSION postgis;"
</pre>
h3. Notes
The geometry features' metadata MUST be set with the proper SRID, which can be tricky. See below.
h3. Import files
h2. Development
See the README file
h2. Configuration
TODO: more about parameters of the conf file
h3. Map
The default view of the map can be configured in the gisaf yaml config, eg:
<pre>
map:
openMapTilesKey: cS3lrAfYXoM4MDooT6aS
zoom: 14
pitch: 45
lat: 12.0000
lng: 79.8106
bearing: 0
style: OSM (vector)
opacity: 0.3
tilesUrl: /tiles/data/india-vector.json
</pre>
h3. Production
Gisaf reads the file @/etc/gisaf/prod.yml@ at boot.
h3. Development
Gisaf reads the @~/.gisaf/prod.yml@ file at boot.
h2. Third party
h3. TileServer
"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.
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).
h4. Install tileserver-gl-light
<pre>
yarn global add tileserver-gl-light
</pre>
h4. 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@)
h4. Service
A systemd service configuration file, in @/etc/systemd/system/tileserver-gl-light.service@:
<pre>
[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
</pre>
h4. Configuration
Eg, in @/etc/tileserver/conf.json@:
<pre>
{
"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"
}
}
}
</pre>
h4. Run the service
<pre>
systemctl enable --now tileserver-gl-light.service
</pre>
h4. nginx proxy
In order the mbtiles to be served by tileserver, add in the nginx conf (adjust eventually):
<pre>
location /tiles/ {
proxy_pass http://127.0.0.1:8080/;
}
</pre>
Gisaf (for, eg, GIS Auroville Front-end) is a web application that is under development.
[[User manual]]
[[Server]]
[[Client]]
[[Stack]]
[[Mapbox]]
h2. Database
Gisaf uses a Postgis database.
h3. Creation
To create an appropriate database, run these commands:
<pre>
createuser avgis -P
createdb avgis -O avgis
psql avgis -c "CREATE EXTENSION postgis;"
</pre>
h3. Notes
The geometry features' metadata MUST be set with the proper SRID, which can be tricky. See below.
h3. Import files
h2. Development
See the README file
h2. Configuration
TODO: more about parameters of the conf file
h3. Map
The default view of the map can be configured in the gisaf yaml config, eg:
<pre>
map:
openMapTilesKey: cS3lrAfYXoM4MDooT6aS
zoom: 14
pitch: 45
lat: 12.0000
lng: 79.8106
bearing: 0
style: OSM (vector)
opacity: 0.3
tilesUrl: /tiles/data/india-vector.json
</pre>
h3. Production
Gisaf reads the file @/etc/gisaf/prod.yml@ at boot.
h3. Development
Gisaf reads the @~/.gisaf/prod.yml@ file at boot.
h2. Third party
h3. TileServer
"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.
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).
h4. Install tileserver-gl-light
<pre>
yarn global add tileserver-gl-light
</pre>
h4. 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@)
h4. Service
A systemd service configuration file, in @/etc/systemd/system/tileserver-gl-light.service@:
<pre>
[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
</pre>
h4. Configuration
Eg, in @/etc/tileserver/conf.json@:
<pre>
{
"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"
}
}
}
</pre>
h4. Run the service
<pre>
systemctl enable --now tileserver-gl-light.service
</pre>
h4. nginx proxy
In order the mbtiles to be served by tileserver, add in the nginx conf (adjust eventually):
<pre>
location /tiles/ {
proxy_pass http://127.0.0.1:8080/;
}
</pre>