Created
March 17, 2022 10:16
-
-
Save asathoor/fc0f89db6584dd7652e3f9a1f42cfdbc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("hej fra vikinger.js") | |
const token = "pk.eyJ1IjoiYXNhdGhvb3IiLCJhIjoiY2oyd3hlbzU3MDA5NzJxbm9iMjczanJndCJ9.HahDB7Z1rrD5THIYQh6t4g" | |
const mapStyle = "mapbox://styles/asathoor/cl0utivlp00jl14qi4gto0iyl" | |
const vikinger = "js/vikinger.geojson" | |
// Concerning the Map | |
mapboxgl.accessToken = token | |
const map = new mapboxgl.Map({ | |
container: 'map', // container ID | |
style: mapStyle, // style URL | |
center: [-50, 56.32], // starting position [lng, lat] | |
zoom: 2.3, // starting zoom | |
pitch: 60, | |
customAttribution: '© Grevinde Danner' | |
}); | |
// begynd fetch() her | |
fetch(vikinger).then( | |
response => { | |
return response.json(); // get JSON data$ | |
}).then(data => { | |
console.log(data); | |
// tjek objektet i browserens udviklingsværktøj | |
}).catch(err => { | |
// Error and description | |
console.log('Error: ' + err) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment