Skip to content

Commit

Permalink
Merge branch 'main' into map
Browse files Browse the repository at this point in the history
  • Loading branch information
KoalaGeo authored May 4, 2023
2 parents f4af929 + df815dd commit 26a7830
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 55 deletions.
2 changes: 1 addition & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def custom_openapi():
return app.openapi_schema
openapi_schema = get_openapi(
title="pyagsapi - AGS File Utilities Tools and API",
version="4.5.2",
version="4.5.3",
description=("The API performs schema validation, data validation and conversion of your AGS files. "
"It also exports a graphical log from AGS data held by NGDC. "
"Schema validation and conversion uses https://gitlab.com/ags-data-format-wg/ags-python-library"),
Expand Down
2 changes: 1 addition & 1 deletion app/static/js/Leaflet.FeatureGroup.OGCAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ L.FeatureGroup.OGCAPI = L.GeoJSON.extend({
* Fired whenever the collection metadata has been loaded.
*/
this.fire("ready");
// this._onReady();
this._onReady();
});
},

Expand Down
101 changes: 53 additions & 48 deletions app/static/js/map.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@

var control = {};
var overlays = {};
var baseMaps = {};

// var control = {};
// var overlays = {};
// var baseMaps = {};


var mapCentre = [54.5, -1.5];
var initZoom = 5.5;
Expand All @@ -11,7 +13,9 @@ var initZoom = 5.5;
var map = L.map('mapid',
{
center: mapCentre, // centre at specified coords
zoom: initZoom
zoom: initZoom,
minZoom: 5,
maxZoom: 18
}
);

Expand Down Expand Up @@ -43,7 +47,7 @@ geologyOfbtn = L.tileLayer.betterWms('http://ogc.bgs.ac.uk/cgi-bin/BGS_Bedrock_a
/** 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?', {
Expand All @@ -68,15 +72,16 @@ var agsboreholes = L.featureGroup
"<b>Project Contractor: </b>" + properties.proj_cont + "<br>" +
"<b>Original LOCA ID: </b>" + properties.loca_id + "<br>" +
"<b>AGS Graphical Log: </b>" + "<a href=" + "https://agsapi.bgs.ac.uk/ags_log/?bgs_loca_id=" + properties.bgs_loca_id + " target=" + "_blank" + ">View</a> / " +"<a href=" + "https://agsapi.bgs.ac.uk/ags_log/?bgs_loca_id=" + properties.bgs_loca_id + "&response_type=attachment" + ">Download</a>" + "<br>" +
"<b>AGS Data: </b>" + "<a href=" + "https://agsapi.bgs.ac.uk/ags_export/?bgs_loca_id=" + properties.bgs_loca_id + " target=" + "_blank" + ">Download</a>" + "<br>" +
// "<b>AGS Data: </b>" + "<a href=" + "https://agsapi.bgs.ac.uk/ags_export/?bgs_loca_id=" + properties.bgs_loca_id + " target=" + "_blank" + ">Download</a>" + "<br>" +
"<b>AGS Submission Record (raw data): </b>" + "<a href=" + properties.dad_item_url + " target=" + "_blank" + ">View</a>" + "<br>";
layer.bindPopup(popupContent);
},
});

agsboreholes.once("ready", function (ev) {
map.fitBounds(agsboreholes.getBounds());
});
}).addTo(map);



// (async () => {
Expand Down Expand Up @@ -107,44 +112,44 @@ agsboreholes.once("ready", function (ev) {
// layer.bindPopup(popupContent);
// }

baseMaps["<span>Topographic</span>"] = topo;
baseMaps["<span>Imagery</span>"] = imagery;
overlays["<span>Geology</span>"] = geologyOfbtn;
overlays["<span>AGS Index</span>"] = agsindex;
overlays["<span>AGS Details</span>"] = agsboreholes;

control = L.control.layers(baseMaps, overlays, { collapsed: false }).addTo(map);

// jQuery UI slider for controling the opacity of the wms layer.
$opacitySlider = $("#opacitySlider").slider({
slide: function (event, ui) {
geologyOfbtn.setOpacity((ui.value / 100).toFixed(1));
},
min: 0,
max: 100,
step: 10,
value: 50
});

// diable dragging when entering div
$("#dOpacitySliderBox").on('mouseover', function () {
map.dragging.disable();
});

// Re-enable dragging when leaving div
$("#dOpacitySliderBox").on('mouseout', function () {
map.dragging.enable();
});

$("#dOpacitySliderBox").click(false);


/** Geocoder search functionality - this is using Esri's location search functionality:
* https://esri.github.io/esri-leaflet/examples/geocoding-control.html */
var searchControl = L.esri.Geocoding.geosearch().addTo(map);
var results = L.layerGroup().addTo(map);

searchControl.on('results', function (data) {
results.clearLayers();
// do something with the search results
});
// baseMaps["<span>Topographic</span>"] = topo;
// baseMaps["<span>Imagery</span>"] = imagery;
// overlays["<span>Geology</span>"] = geologyOfbtn;
// overlays["<span>AGS Index</span>"] = agsindex;
// overlays["<span>AGS Details</span>"] = agsboreholes;

// control = L.control.layers(baseMaps, overlays, { collapsed: false }).addTo(map);

// // jQuery UI slider for controling the opacity of the wms layer.
// $opacitySlider = $("#opacitySlider").slider({
// slide: function (event, ui) {
// geologyOfbtn.setOpacity((ui.value / 100).toFixed(1));
// },
// min: 0,
// max: 100,
// step: 10,
// value: 50
// });

// // diable dragging when entering div
// $("#dOpacitySliderBox").on('mouseover', function () {
// map.dragging.disable();
// });

// // Re-enable dragging when leaving div
// $("#dOpacitySliderBox").on('mouseout', function () {
// map.dragging.enable();
// });

// $("#dOpacitySliderBox").click(false);


// /** Geocoder search functionality - this is using Esri's location search functionality:
// * https://esri.github.io/esri-leaflet/examples/geocoding-control.html */
// var searchControl = L.esri.Geocoding.geosearch().addTo(map);
// var results = L.layerGroup().addTo(map);

// searchControl.on('results', function (data) {
// results.clearLayers();
// // do something with the search results
// });
2 changes: 1 addition & 1 deletion app/templates/_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@
<hr>
<br>
<div>
Powered by <a title="pyagsapi" href="https://github.com/BritishGeologicalSurvey/pyagsapi">pyagsapi 4.5.2</a>. pyagsapi was created by and is maintained by the <a href="https://www.bgs.ac.uk/">British Geological Survey</a> and is distributed under the <a title="license" href="https://github.com/BritishGeologicalSurvey/pyagsapi/blob/main/LICENSE">LGPL v3.0 licence</a>, code is available on <a title="github" href="https://github.com/BritishGeologicalSurvey/pyagsapi">GitHub</a>. <a title="agspython" href="https://github.com/BritishGeologicalSurvey/pyagsapi">pyagsapi</a> uses the <a href="https://gitlab.com/ags-data-format-wg/ags-python-library.">Official AGS Python Library</a>.
Powered by <a title="pyagsapi" href="https://github.com/BritishGeologicalSurvey/pyagsapi">pyagsapi 4.5.3</a>. pyagsapi was created by and is maintained by the <a href="https://www.bgs.ac.uk/">British Geological Survey</a> and is distributed under the <a title="license" href="https://github.com/BritishGeologicalSurvey/pyagsapi/blob/main/LICENSE">LGPL v3.0 licence</a>, code is available on <a title="github" href="https://github.com/BritishGeologicalSurvey/pyagsapi">GitHub</a>. <a title="agspython" href="https://github.com/BritishGeologicalSurvey/pyagsapi">pyagsapi</a> uses the <a href="https://gitlab.com/ags-data-format-wg/ags-python-library.">Official AGS Python Library</a>.
</div>
</main>
<footer>
Expand Down
7 changes: 3 additions & 4 deletions app/templates/landing_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,15 @@ <h4>Future data validation rules: (Coming Soon)</h4>
<h2>AGS Data Discovery</h2>
<br>
<p>Use the map below to find AGS data, click on the markers to find borehole information, links to graphical logs and the original submitted data.</p>
<p><b>The map will show a maximum of 100 markers - zooming may be required to display markers of interest. </b></p>
<p><b>The map will show a maximum of 100 AGS markers - users may need to pan/zoom to display markers of interest. </b></p>
<p><b>If no AGS Submission Record is shown at the link provided there is likely a legacy confidentiality restriction.</b></p>
<br>
<div id="mapid">
<div id="dOpacitySliderBox">
<!-- <div id="dOpacitySliderBox">
<div id="opacitySlider"></div>
<div class="dOpacitySliderLabel">Transparency</div>
</div>
</div>-->
</div>

</section>
<br>
<br>
Expand Down

0 comments on commit 26a7830

Please sign in to comment.