From 9d33a74ee8b2ddffe1980d436020ab96d988cfe5 Mon Sep 17 00:00:00 2001 From: KoalaGeo Date: Tue, 9 May 2023 14:12:00 +0100 Subject: [PATCH 1/2] Add layer control & increase feature limit to 400 --- app/static/js/Leaflet.FeatureGroup.OGCAPI.js | 2 +- app/static/js/map.js | 26 +++++++++++--------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/static/js/Leaflet.FeatureGroup.OGCAPI.js b/app/static/js/Leaflet.FeatureGroup.OGCAPI.js index c1e0a1a6..c2f50d7a 100644 --- a/app/static/js/Leaflet.FeatureGroup.OGCAPI.js +++ b/app/static/js/Leaflet.FeatureGroup.OGCAPI.js @@ -40,7 +40,7 @@ L.FeatureGroup.OGCAPI = L.GeoJSON.extend({ * @option limit = 100 * The maximum amount of features to have on the map at any given time. */ - limit: 100, + limit: 400, /** * @option padding: Number = 0.1 diff --git a/app/static/js/map.js b/app/static/js/map.js index 585fd318..6fc8e62c 100644 --- a/app/static/js/map.js +++ b/app/static/js/map.js @@ -1,7 +1,7 @@ -// var control = {}; -// var overlays = {}; -// var baseMaps = {}; +var control = {}; +var overlays = {}; +var baseMaps = {}; var mapCentre = [54.5, -1.5]; var initZoom = 5.5; @@ -45,7 +45,7 @@ geologyOfbtn = L.tileLayer.betterWms('https://ogc.bgs.ac.uk/cgi-bin/BGS_Bedrock_ /** Add Esri basemap layers to map - this is using the esri-leaflet.js extension * for Leaflet and makes it easier to include Esri functionality in to Leaflet maps: https://esri.github.io/esri-leaflet */ var topo = L.esri.basemapLayer("Topographic").addTo(map); -// var imagery = L.esri.basemapLayer("Imagery"); +var imagery = L.esri.basemapLayer("Imagery"); /** Use the L.tileLayer.betterWms extension to load the AGS wms layer */ var agsindex = L.tileLayer.wms('https://map.bgs.ac.uk/arcgis/services/AGS/AGS_Export/MapServer/WMSServer?', { @@ -60,6 +60,8 @@ var agsindex = L.tileLayer.wms('https://map.bgs.ac.uk/arcgis/services/AGS/AGS_Ex var agsboreholes = L.featureGroup .ogcApi("https://ogcapi.bgs.ac.uk/", { collection: "agsboreholeindex", + pane: "overlays", + limit: 400, onEachFeature: function (feat, layer) { var properties = feat.properties; var popupContent = "AGS Borehole Information

" + @@ -76,9 +78,11 @@ var agsboreholes = L.featureGroup }, }); -agsboreholes.once("ready", function (ev) { - map.fitBounds(agsboreholes.getBounds()); -}).addTo(map); +agsboreholes.on("ready", () => {map.addLayer(agsboreholes);}) + +// agsboreholes.once("ready", function (ev) { +// map.fitBounds(agsboreholes.getBounds()); +// }).addTo(map); // (async () => { @@ -109,13 +113,13 @@ agsboreholes.once("ready", function (ev) { // layer.bindPopup(popupContent); // } -// baseMaps["Topographic"] = topo; -// baseMaps["Imagery"] = imagery; -// overlays["Geology"] = geologyOfbtn; +baseMaps["Topographic"] = topo; +baseMaps["Imagery"] = imagery; +overlays["Geology"] = geologyOfbtn; // overlays["AGS Index"] = agsindex; // overlays["AGS Details"] = agsboreholes; -// control = L.control.layers(baseMaps, overlays, { collapsed: false }).addTo(map); +control = L.control.layers(baseMaps, overlays, { collapsed: false }).addTo(map); // // jQuery UI slider for controling the opacity of the wms layer. // $opacitySlider = $("#opacitySlider").slider({ From 68f6776d3a1ed1733720071d4a4899596ac52a56 Mon Sep 17 00:00:00 2001 From: KoalaGeo Date: Tue, 9 May 2023 14:13:19 +0100 Subject: [PATCH 2/2] use 200 feature limit --- app/static/js/Leaflet.FeatureGroup.OGCAPI.js | 2 +- app/static/js/map.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/static/js/Leaflet.FeatureGroup.OGCAPI.js b/app/static/js/Leaflet.FeatureGroup.OGCAPI.js index c2f50d7a..7ea0955f 100644 --- a/app/static/js/Leaflet.FeatureGroup.OGCAPI.js +++ b/app/static/js/Leaflet.FeatureGroup.OGCAPI.js @@ -40,7 +40,7 @@ L.FeatureGroup.OGCAPI = L.GeoJSON.extend({ * @option limit = 100 * The maximum amount of features to have on the map at any given time. */ - limit: 400, + limit: 200, /** * @option padding: Number = 0.1 diff --git a/app/static/js/map.js b/app/static/js/map.js index 6fc8e62c..2b699223 100644 --- a/app/static/js/map.js +++ b/app/static/js/map.js @@ -61,7 +61,7 @@ var agsboreholes = L.featureGroup .ogcApi("https://ogcapi.bgs.ac.uk/", { collection: "agsboreholeindex", pane: "overlays", - limit: 400, + limit: 200, onEachFeature: function (feat, layer) { var properties = feat.properties; var popupContent = "AGS Borehole Information

" +