Use absolute path for geojson

This commit is contained in:
Nicolò P 2023-09-07 11:10:34 +02:00
parent 47b21ecc8a
commit b0e8a449bb
4 changed files with 8410 additions and 2497 deletions

File diff suppressed because it is too large Load Diff

8398
js/fieldwork.geojson Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,17 @@
document.addEventListener('DOMContentLoaded', async () => { document.addEventListener('DOMContentLoaded', async () => {
const BASE_URL = location.href;
const map = L.map('map').setView([27.49, -9.3], 3); const map = L.map('map').setView([27.49, -9.3], 3);
map.crs = L.CRS.EPSG4326; map.crs = L.CRS.EPSG4326;
const world = await fetch('/world.geojson').then(res => res.json()); const world = await fetch(`${BASE_URL}js/world.geojson`)
const fieldwork = await fetch('/fieldwork.geojson').then(res => res.json()); .then(res => res.json())
.catch(error => console.log('AJAX request error: ', error));
const fieldwork = await fetch(`${BASE_URL}js/fieldwork.geojson`)
.then(res => res.json())
.catch(error => console.log('AJAX request error: ', error));
L.geoJson(world,{ L.geoJson(world,{
style: function () { style: function () {
@ -34,9 +41,8 @@ document.addEventListener('DOMContentLoaded', async () => {
riseOnHover : true riseOnHover : true
}).addTo(map); }).addTo(map);
let egypt2 = L.marker([30.5494,31.9636], { let greece = L.marker([39.2739,20.6869], {
title: 'Wadi Tumilat', title: 'Pandosia',
riseOnHover : true riseOnHover : true
}).addTo(map); }).addTo(map);
});
})