Show an error if a layer is too large.

The map view limits the size of layers (both user and regular) in
order to keep the system responsive, as Leaflet is not great at
handling large layers.
This commit is contained in:
D. Berge
2023-09-12 11:23:36 +02:00
parent 9e73f2603a
commit 57b9b420f8

View File

@@ -475,7 +475,7 @@ export default {
bounds._northEast.lng,
bounds._northEast.lat
].map(i => i.toFixed(bboxScale)).join(",");
const limit = 10000;
const limit = 10000; // Empirical value
const query = new URLSearchParams({bbox, limit});
@@ -521,7 +521,9 @@ export default {
l.layer.lastRequestURL = url;
} else {
console.warn("Too much data from", url);
console.warn(`Too much data from ${url} (${layer.features.length ?? layer.length}${limit} features)`);
this.showSnack([`Layer ${l.layer.options.userLayerName} is too large: ${layer.features.length ?? layer.length} features; maximum is ${limit}`, "error"]);
}
})
.finally( () => {
@@ -783,7 +785,7 @@ export default {
this.addUserLayers(userLayers);
},
...mapActions(["api"])
...mapActions(["api", "showSnack"])
},