diff --git a/ags_map/index.html b/ags_map/index.html index e93e324..f56136f 100644 --- a/ags_map/index.html +++ b/ags_map/index.html @@ -17,6 +17,7 @@ src="https://unpkg.com/leaflet/dist/leaflet-src.js" crossorigin="" > + diff --git a/ags_map/js/map.js b/ags_map/js/map.js index 76b5f30..ee50bde 100644 --- a/ags_map/js/map.js +++ b/ags_map/js/map.js @@ -1,22 +1,26 @@ -var map = L.map("map", { - center: [54.093409, -2.89479], - zoom: 6, +mapLink = + 'Esri'; + +wholink = + 'i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'; + +var esri = L.tileLayer( + 'http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', { + attribution: '© '+mapLink+', '+wholink, + maxZoom: 18, }); var positron = L.tileLayer( - "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png", - { - attribution: - '© OpenStreetMap contributors, © CartoDB', - } -).addTo(map); + "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png", { + attribution: '© OpenStreetMap contributors, © CartoDB', +}); var wmsLayer = L.tileLayer.wms('https://map.bgs.ac.uk/arcgis/services/AGS/AGS_Export/MapServer/WMSServer?', { layers: 'Boreholes', - format: 'image/png', - transparent: true, + format: 'image/png', + transparent: true, attribution: "AGS Data from British Geological Survey", -}).addTo(map); +}); var agsboreholes = L.featureGroup .ogcApi("https://ogcapi.bgs.ac.uk/", { @@ -34,9 +38,19 @@ var agsboreholes = L.featureGroup "AGS Submission Record (raw data): " + "View" + "
"; layer.bindPopup(popupContent); }, -}) -.addTo(map); +}); + +var map = L.map("map", { + center: [54.093409, -2.89479], + zoom: 6, + layers: [esri, positron, wmsLayer, agsboreholes] +}); + +L.control.layers({ + "Esri": esri, + "Positron": positron +}).addTo(map); agsboreholes.once("ready", function (ev) { map.fitBounds(agsboreholes.getBounds()); -}); \ No newline at end of file +});