feat: Use versatiles map
This commit is contained in:
parent
43f48e5659
commit
9d5f2462e6
@ -1,29 +1,18 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
<div id="map"></div>
|
<!-- add MapLibre JavaScript and CSS -->
|
||||||
|
<script src="https://tiles.versatiles.org/assets/maplibre-gl/maplibre-gl.js"></script>
|
||||||
|
<link href="https://tiles.versatiles.org/assets/maplibre-gl/maplibre-gl.css" rel="stylesheet" />
|
||||||
|
|
||||||
<script src="{% static 'fellchensammlung/leaflet.js' %}"></script>
|
<!-- add container for the map -->
|
||||||
|
<div id="map" style="width:100%;aspect-ratio:16/9"></div>
|
||||||
|
|
||||||
|
<!-- start map -->
|
||||||
<script>
|
<script>
|
||||||
// Initialize the map and set its view to the desired geographical coordinates and zoom level
|
let map = new maplibregl.Map({
|
||||||
var map = L.map('map').setView([51.505, -0.09], 13);
|
container: 'map',
|
||||||
|
style: 'https://tiles.versatiles.org/assets/styles/colorful.json'
|
||||||
// Add the OpenStreetMap tile layer
|
}).addControl(new maplibregl.NavigationControl());
|
||||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
const marker = new maplibregl.Marker()
|
||||||
maxZoom: 19,
|
.setLngLat([9.545, 48.105835])
|
||||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
.addTo(map);
|
||||||
}).addTo(map);
|
|
||||||
|
|
||||||
// Example coordinates for markers
|
|
||||||
var markers = [
|
|
||||||
{coords: [51.5, -0.09], popup: "Marker 1"},
|
|
||||||
{coords: [51.515, -0.1], popup: "Marker 2"},
|
|
||||||
{coords: [51.52, -0.12], popup: "Marker 3"}
|
|
||||||
];
|
|
||||||
|
|
||||||
// Loop through the marker coordinates and add them to the map
|
|
||||||
markers.forEach(function (marker) {
|
|
||||||
L.marker(marker.coords).addTo(map)
|
|
||||||
.bindPopup(marker.popup)
|
|
||||||
.openPopup();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user