Skip to content

Commit 48b9421

Browse files
author
Yves Serrano
committed
Merge branch 'master' into stage
2 parents 7344ad3 + 197c4a0 commit 48b9421

File tree

3 files changed

+72
-57
lines changed

3 files changed

+72
-57
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ Add `www.local` and `django` to the 127.0.0.1 entry in `/etc/hosts` (for screens
3434

3535
```bash
3636
touch env.hosts.prod # required file, can be empty and edited later
37-
cp etc/nginx/www.local.dev etc/nginx/www.local.conf # default www.local.conf is not under version control
37+
# for local development add a symlink to the nginx configuration file, for production use a dedicated copy
38+
ln -s etc/nginx/www.local.dev etc/nginx/www.local.conf # default www.local.conf is not under version control
3839
```
3940

4041
download containers and start them

RELEASE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
- Added API for snapshot upload
1111
- Added site config for homepage_snippet and search_enabled
1212

13+
*Upgrade notes*:
14+
- Upgrading to 0.7.0 changes to how snapshots are stored and hence requires a snapshot data migration
15+
- For local development symlinking the current nginx configuration is recommended (see README.md for details)
16+
1317
### 0.6.2
1418
[Released *2020-11-16*](https://bitbucket.org/cividi/gemeindescan-webui/commits/tag/0.6.2)
1519

vue/src/components/SnapshotMap.vue

Lines changed: 66 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -202,71 +202,81 @@ export default {
202202
},
203203
204204
setupMapbox() {
205-
this.geobounds = [
206-
geostring2array(this.geojson.views[0].spec.bounds[0]),
207-
geostring2array(this.geojson.views[0].spec.bounds[1])
208-
];
205+
try {
206+
this.geobounds = [
207+
geostring2array(this.geojson.views[0].spec.bounds[0]),
208+
geostring2array(this.geojson.views[0].spec.bounds[1])
209+
];
209210
210-
const lookupResources = {}; // name -> index
211-
this.geojson.resources.forEach((resource, index) => {
212-
lookupResources[resource.name] = index;
213-
});
211+
const lookupResources = {}; // name -> index
212+
this.geojson.resources.forEach((resource, index) => {
213+
lookupResources[resource.name] = index;
214+
});
214215
215-
this.geojson.views[0].resources.forEach((resourceName) => {
216-
this.layers.push(
217-
this.geojson.resources[lookupResources[resourceName]]
218-
);
219-
});
216+
this.geojson.views[0].resources.forEach((resourceName) => {
217+
this.layers.push(
218+
this.geojson.resources[lookupResources[resourceName]]
219+
);
220+
});
221+
} catch (error) {
222+
console.log(error);
223+
this.isMapLoaded = true;
224+
}
220225
},
221226
222227
displayMapbox() {
223-
L.mapbox.accessToken = process.env.VUE_APP_MAPBOX_ACCESSTOKEN;
224-
const boxSize = 800;
225-
const bounds = geoViewport.viewport(this.geobounds.flat(), [boxSize, boxSize]);
226-
this.map = L.mapbox.map('map').setView(bounds.center, bounds.zoom);
227-
this.layerContainer = new L.LayerGroup();
228-
// default test layer // this.layerContainer.addLayer(L.mapbox.styleLayer('mapbox://styles/mapbox/light-v10'));
229-
if (this.hash) { // full snapshot with hash
230-
this.layers.forEach((layer) => {
231-
if (layer.mediatype === 'application/vnd.mapbox-vector-tile') {
232-
const tileLayer = L.mapbox.styleLayer(layer.path);
233-
tileLayer.on('load', () => { this.isMapLoaded = true; });
234-
this.layerContainer.addLayer(tileLayer);
235-
} else if (layer.mediatype === 'application/geo+json') {
236-
this.layerContainer.addLayer(L.mapbox.featureLayer(layer.data, {
237-
attribution: this.geojson.views[0].spec.attribution
238-
}));
239-
} else if (layer.mediatype === 'application/vnd.simplestyle-extended') {
240-
this.layerContainer.addLayer(this.createFeatureLayer(
241-
layer.data.features, this.geojson.views[0].spec.attribution
228+
try {
229+
L.mapbox.accessToken = process.env.VUE_APP_MAPBOX_ACCESSTOKEN;
230+
const boxSize = 800;
231+
const bounds = geoViewport.viewport(this.geobounds.flat(), [boxSize, boxSize]);
232+
this.map = L.mapbox.map('map').setView(bounds.center, bounds.zoom);
233+
this.layerContainer = new L.LayerGroup();
234+
// default test layer // this.layerContainer.addLayer(L.mapbox.styleLayer('mapbox://styles/mapbox/light-v10'));
235+
if (this.hash) { // full snapshot with hash
236+
this.layers.forEach((layer) => {
237+
if (layer.mediatype === 'application/vnd.mapbox-vector-tile') {
238+
const tileLayer = L.mapbox.styleLayer(layer.path);
239+
tileLayer.on('load', () => { this.isMapLoaded = true; });
240+
this.layerContainer.addLayer(tileLayer);
241+
} else if (layer.mediatype === 'application/geo+json') {
242+
this.layerContainer.addLayer(L.mapbox.featureLayer(layer.data, {
243+
attribution: this.geojson.views[0].spec.attribution
244+
}));
245+
} else if (layer.mediatype === 'application/vnd.simplestyle-extended') {
246+
this.layerContainer.addLayer(this.createFeatureLayer(
247+
layer.data.features, this.geojson.views[0].spec.attribution
248+
));
249+
}
250+
});
251+
} else if (this.bfsNumber) { // empty municipality
252+
this.geojson.coordinates.forEach((polygon) => {
253+
this.layerContainer.addLayer(L.polygon(polygon, { color: '#543076' }));
254+
});
255+
if (process.env.VUE_APP_MAPBOX_DEFAULT_STYLES) {
256+
this.layerContainer.addLayer(L.mapbox.styleLayer(
257+
process.env.VUE_APP_MAPBOX_DEFAULT_STYLES
242258
));
243259
}
244-
});
245-
} else if (this.bfsNumber) { // empty municipality
246-
this.geojson.coordinates.forEach((polygon) => {
247-
this.layerContainer.addLayer(L.polygon(polygon, { color: '#543076' }));
248-
});
249-
if (process.env.VUE_APP_MAPBOX_DEFAULT_STYLES) {
250-
this.layerContainer.addLayer(L.mapbox.styleLayer(
251-
process.env.VUE_APP_MAPBOX_DEFAULT_STYLES
252-
));
253260
}
254-
}
255-
this.layerContainer.addTo(this.map);
256-
L.control.scale({
257-
metric: true,
258-
imperial: false
259-
}).addTo(this.map);
261+
this.layerContainer.addTo(this.map);
262+
L.control.scale({
263+
metric: true,
264+
imperial: false
265+
}).addTo(this.map);
260266
261-
if (this.screenshotMode) {
262-
// no zoom controls in screenshot mode
263-
document.querySelector('.leaflet-control-zoom').style.display = 'none';
264-
} else {
265-
// no attribution in normal mode
266-
document.querySelector('.leaflet-control-attribution').style.display = 'none';
267-
}
268-
if (this.screenshotIsThumbnail) {
269-
document.querySelector('#mapinfo').style.visibility = 'hidden';
267+
if (this.screenshotMode) {
268+
// no zoom controls in screenshot mode
269+
document.querySelector('.leaflet-control-zoom').style.display = 'none';
270+
} else {
271+
// no attribution in normal mode
272+
document.querySelector('.leaflet-control-attribution').style.display = 'none';
273+
}
274+
if (this.screenshotIsThumbnail) {
275+
document.querySelector('#mapinfo').style.visibility = 'hidden';
276+
}
277+
} catch (error) {
278+
console.log(error);
279+
this.isMapLoaded = true;
270280
}
271281
// L.control.zoom({ position: 'bottomleft' }).addTo(this.map);
272282
// this.map.addLayer(L.rectangle(this.geobounds, { color: 'red', weight: 1 }));

0 commit comments

Comments
 (0)