Skip to content

Commit

Permalink
working except control layer
Browse files Browse the repository at this point in the history
  • Loading branch information
KoalaGeo committed May 2, 2023
1 parent 18e7854 commit 811a363
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
1 change: 1 addition & 0 deletions ags_map/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
src="https://unpkg.com/leaflet/dist/leaflet-src.js"
crossorigin=""
></script>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha256-WBkoXOwTeyKclOHuWtc+i2uENFpDZ9YPdf5Hf+D7ewM=" crossorigin=""></script>

<script src="js/Leaflet.FeatureGroup.OGCAPI.js"></script>
</head>
Expand Down
44 changes: 29 additions & 15 deletions ags_map/js/map.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
var map = L.map("map", {
center: [54.093409, -2.89479],
zoom: 6,
mapLink =
'<a href="http://www.esri.com/">Esri</a>';

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: '&copy; '+mapLink+', '+wholink,
maxZoom: 18,
});

var positron = L.tileLayer(
"https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",
{
attribution:
'&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>',
}
).addTo(map);
"https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png", {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>',
});

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/", {
Expand All @@ -34,9 +38,19 @@ var agsboreholes = L.featureGroup
"<b>AGS Submission Record (raw data): </b>" + "<a href=" + properties.dad_item_url + " target=" + "_blank" + ">View</a>" + "<br>";
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());
});
});

0 comments on commit 811a363

Please sign in to comment.