From 57b9b420f83c81657f7b72f2d69409dd33a4ec09 Mon Sep 17 00:00:00 2001 From: "D. Berge" Date: Tue, 12 Sep 2023 11:23:36 +0200 Subject: [PATCH] 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. --- lib/www/client/source/src/views/Map.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/www/client/source/src/views/Map.vue b/lib/www/client/source/src/views/Map.vue index 993e34b..9d8d426 100644 --- a/lib/www/client/source/src/views/Map.vue +++ b/lib/www/client/source/src/views/Map.vue @@ -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"]) },