8 months ago

Converting the following to loop

Posted 8 months ago by Nana-Odai

i'am creating a map using leaflet

I have been able to to get this locations on the map. but i want to query the details, the latitudes, and longitudes and popup mesage from the database. which i will loop through. how do i go about it

var littleton = L.marker([39.61, -105.02]).bindPopup('This is Littleton, CO.'),
        denver    = L.marker([39.74, -104.99]).bindPopup('This is Denver, CO.'),
        aurora    = L.marker([39.73, -104.8]).bindPopup('This is Aurora, CO.'),
        golden    = L.marker([39.77, -105.23]).bindPopup('This is Golden, CO.');

        var cities = L.layerGroup([littleton, denver, golden, aurora]);

The cities is called in this map

    var map ='mapid', {
            center: [39.73, -104.99],
            zoom: 10,
            layers: [grayscale, cities]

Please sign in or create an account to participate in this conversation.