intégration de marqueurs à l'aide d'une api en POO

Par Micka Bup, il y a 7 ans


Bonjour,
Pour un projet, je dois intégrer des marqueurs sur une carte (leaflet,openstreetmap) à l'aide de l'api JCdecaux.
Le problème c'est que je n'arrive vraiment pas à intégrer ces marqueurs.

let leaf = document.getElementById("mapid"); let locations = []; class CreateMap { constructor(url, map) { this.url = " https://api.jcdecaux.com/vls/v1/stations?contract=Luxembourg&apiKey=a6cdcb5a3c737e4a7e5d446fbd1b8e518e921f9f"; this.map = L.map('mapid').setView([49.611622, 6.131935], 18); L.tileLayer("https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png ", { attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/"></a>', maxZoom: 18, }).addTo(this.map); this.ajaxRequete(); } ajaxRequete() { ajaxGet(this.url, (reponse) => { let stations = JSON.parse(reponse); stations.forEach((station) => { let marker = L.marker([ this.position = station.position, this.address = station.address, this.number = station.number, this.name = station.name, this.available_bike_stands = station.available_bike_stands, this.available_bikes = station.available_bikes, this.bike_stands = station.bike_stands, this.bonus = station.bonus, this.contract_name = station.contract_name, this.banking = station.banking, this.status = station.status, this.last_update = station.last_update ]) }) locations.push(stations); }) } } let createMap = new CreateMap(leaf, locations);

J'aimerais savoir quelle erreur j'ai bien pu faire car dans mon tableau locations, j'ai bien intégrer toutes les informations.

Aucune réponse