Group Marker MapQuest

4 posts / 0 new
Last post
kenkaio
Group Marker MapQuest

Hello,

I'm a french guy and i'll try to explain my problem :) 

I use API MAPquest, no problem to integrate it to my website. 

 

But i have some many marker on my map and want to group it : 

my map : 

http://image.noelshack.com/fichiers/2018/43/4/1540469038-map.png

i want :

http://image.noelshack.com/fichiers/2018/43/4/1540469165-map1.png

and when i click on a marker, make a zoom and pop markers in this zone 

 

My code :

window.onload = function() {

    L.mapquest.key = 'myKey';

 

    var map = L.mapquest.map('map', {

    center: [45.75, 4.85],

    layers: L.mapquest.tileLayer('map'),

    zoom: 12

    });

 

    ajaxGet("https://api.jcdecaux.com/vls/v1/stations?contract=Lyon&apiKey=myKey", function (reponse) {

        // Transforme la réponse en un tableau d'articles

        var listePoints = JSON.parse(reponse);    

 

   for (var i = listePoints.length - 1; i >= 0; i--) {

    L.marker([listePoints[i].position.lat, listePoints[i].position.lng], {

          icon: L.mapquest.icons.marker(),

          draggable: false

        }).bindPopup(listePoints[i].address).addTo(map);

    };

});

    

};

 

ty ! 

 

 

edit: 

i see my response, ty ! :) 

https://developer.mapquest.com/documentation/mapquest-js/v1.0/examples/s...


MQBrianCoakley
My favorite is marker
My favorite is marker clusters (I've used it often). But I've also used heat maps (a few times) and canvas (once).

kenkaio
But now

But now

When i click on a marker i want to know is attribute 

How can i make this ? 

 

I try : 

$("img").click(function(){

var titre = this.alt;

console.log(titre);

});

 

but nothing 


MQBrianCoakley
Here is how I grabbed the

Here is how I grabbed the marker's icon.

 

[marker].on("click", function(evt){console.log(evt.target.options.icon.options.iconUrl);})