Skip to content
Snippets Groups Projects
Commit 1e439c1c authored by Mitchell Harrop's avatar Mitchell Harrop
Browse files

Upload New File

parent 8f41b680
No related branches found
No related tags found
No related merge requests found
Pipeline #161370 passed
<!DOCTYPE html>
<html lang="en">
<head>
<!--
This work is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
https://creativecommons.org/licenses/by-nc-sa/4.0/?ref=chooser-v1
https://creativecommons.org/licenses/by-nc-sa/4.0/
Mitchell Harrop, The University of Melbourne.
-->
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Map</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"><!-- https://fonts.google.com/icons -->
<style>
#MapLocation {
height: 99vh;
position: relative;
}
#transparencySlider {
width: 100px;
}
#legend {
display: block;
position: absolute;
bottom: 70px;
left: 10px;
background-color: white;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
z-index: 1000;
max-height: 600px;
overflow-y: auto;
}
.legend-item {
display: block;
margin-bottom: 5px;
}
</style>
</head>
<body>
<div id="MapLocation"></div>
<div id="legend">
<div class="legend-item">
<input type="range" min="0" max="1" step="0.1" value="1" id="transparencySlider">
</div>
</div>
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
<script>
// Helper function to extract the ID from a given URL
function extractIdFromUrl(url) {
const matches = url.match(/\/maps\/(\d+)\/?$/);
return matches ? matches[1] : null;
}
const config = {
"mapwarper": {
"https://mapwarper.net/maps/82968": "Sands & McDougall's Melbourne directory map (<a href='http://hdl.handle.net/11343/23977' target='_blank'>1869?</a>).",
"https://mapwarper.net/maps/82975": "Plan No. 27 East Melbourne (<a href='http://hdl.handle.net/11343/24037' target='_blank'>1895?</a>).",
"https://mapwarper.net/maps/82976": "Plan No. 25 City of Melbourne (<a href='http://hdl.handle.net/11343/24043' target='_blank'>1895?</a>).",
"https://mapwarper.net/maps/83365": "Plan No. 36 Richmond (<a href='http://hdl.handle.net/11343/24042' target='_blank'>1895?</a>).",
"https://mapwarper.net/maps/83363": "Plan No. 42 Richmond (<a href='http://handle.slv.vic.gov.au/10381/142445' target='_blank'>1895?</a>).",
"https://mapwarper.net/maps/82979": "Sands and McDougall Pty. Ltd. New Map of Melbourne and Suburbs (<a href='http://hdl.handle.net/11343/216245' target='_blank'>1920?</a>).",
"https://mapwarper.net/maps/83035": "Morgan's Official Street Directory, Melbourne & Suburbs, Map 1, part 1 (<a href='http://handle.slv.vic.gov.au/10381/288173' target='_blank'>1935</a>).",
"https://mapwarper.net/maps/80120": "Morgan's Official Street Directory, Melbourne & Suburbs, Map 1, part 2 (<a href='http://handle.slv.vic.gov.au/10381/288173' target='_blank'>1935</a>).",
"https://mapwarper.net/maps/83034": "Morgan's Official Street Directory, Melbourne & Suburbs, Map 53 (<a href='http://handle.slv.vic.gov.au/10381/288173' target='_blank'>1935</a>).",
"https://mapwarper.net/maps/83031": "Morgan's Official street directory. Melbourne & Suburbs. Map 1 (<a href='http://handle.slv.vic.gov.au/10381/288448' target='_blank'>1951</a>).",
"https://mapwarper.net/maps/83032": "Morgan's Official street directory. Melbourne & Suburbs. Map 1a (<a href='http://handle.slv.vic.gov.au/10381/288448' target='_blank'>1951</a>).",
"https://mapwarper.net/maps/83033": "Morgan's Official street directory. Melbourne & Suburbs. Map 53 (<a href='http://handle.slv.vic.gov.au/10381/288448' target='_blank'>1951</a>)."
},
"mapCentre": "-37.840935, 144.946457",
"mapZoom": "11"
};
var mapwarper = config['mapwarper'];
var mapZoom = config['mapZoom'];
var mapCentre = config['mapCentre'].split(",");
var map;
var baseLayer;
var mapWarperLayers = new Array();
map = L.map('MapLocation', {
center: mapCentre,
zoom: mapZoom,
layers: [
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png')
]
});
var overlayMaps = {};
if (mapwarper) {
for (var url in mapwarper) {
if (mapwarper.hasOwnProperty(url)) {
var label = mapwarper[url];
var id = extractIdFromUrl(url);
if (id) {
var baseUrl = url.match(/^(https?:\/\/[^\/]+)/)[1];
overlayMaps[label] = L.tileLayer(baseUrl + '/maps/tile/' + id + '/{z}/{x}/{y}.png', {
attribution: '<a href="' + baseUrl + '" >State Library Victoria; The University of Melbourne</a>',
tms: false
});
}
}
}
}
L.control.layers(null, overlayMaps, { collapsed: false }).addTo(map);
document.getElementById('transparencySlider').addEventListener('input', function () {
var opacity = this.value;
for (var label in overlayMaps) {
if (overlayMaps.hasOwnProperty(label)) {
overlayMaps[label].setOpacity(opacity);
}
}
});
</script>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment