Use absolute path for geojson
This commit is contained in:
parent
47b21ecc8a
commit
b0e8a449bb
2491
fieldwork.geojson
2491
fieldwork.geojson
File diff suppressed because it is too large
Load Diff
8398
js/fieldwork.geojson
Normal file
8398
js/fieldwork.geojson
Normal file
File diff suppressed because it is too large
Load Diff
18
js/index.js
18
js/index.js
@ -1,10 +1,17 @@
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const BASE_URL = location.href;
|
||||
|
||||
const map = L.map('map').setView([27.49, -9.3], 3);
|
||||
|
||||
map.crs = L.CRS.EPSG4326;
|
||||
|
||||
const world = await fetch('/world.geojson').then(res => res.json());
|
||||
const fieldwork = await fetch('/fieldwork.geojson').then(res => res.json());
|
||||
const world = await fetch(`${BASE_URL}js/world.geojson`)
|
||||
.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,{
|
||||
style: function () {
|
||||
@ -34,9 +41,8 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
riseOnHover : true
|
||||
}).addTo(map);
|
||||
|
||||
let egypt2 = L.marker([30.5494,31.9636], {
|
||||
title: 'Wadi Tumilat',
|
||||
let greece = L.marker([39.2739,20.6869], {
|
||||
title: 'Pandosia',
|
||||
riseOnHover : true
|
||||
}).addTo(map);
|
||||
|
||||
})
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user