How to reduce the Hits?

4 posts / 0 new
Last post
How to reduce the Hits?


For ‘N’  locations it consumes maximum 3 Maps Transaction hits.

Here's our code 

function LoadMapQuest(mapData) {

//mapData: Array of Geocodes (LatLong) - Marker Locations


    map = new L.Map('map_canvas', {

        layers: MQ.mapLayer(),

        center: [-343.8250062, -115.1225185],

        zoom: 10


    L.tileLayer('http://{s}{z}/{x}/{y}.png', {

        attribution: '&copy; <a href="">OpenStreetMap</a>',

        subdomains: ['a', 'b', 'c']



    var lightIcon = L.Icon.Default;

    var bounds = new L.LatLngBounds();

    for (i = 0; i < mapData.length; i++) {

        var iconUrl = '/image/marker.png';

        var datum = mapData[i];

        var loc = new L.LatLng(, datum.lon);



        var desc = "<b> Location: </b>" + mapData[i].location + '<br><b>Address: </b>' + mapData[i].address + '<br><b>Open Calls: </b>' + mapData[i].jobs;

        map.addLayer(L.marker(loc, { icon: iconUrl }).bindPopup(desc));


    map.fitBounds(bounds); = map;


Could you suggest if there is any way to reduce the number of tansactions hits.


You could put all of the
You could put all of the markers on the map before the tile layer has been added. This way the map is created, centered, and zoomed before the tile layer is displayed.

Thanks for your response

Thanks for your response.

I put all of the markers on the map before the tile layer has been added, But it count 3 transactions as before. Could you please confirm that regardless the number of markers/locations, it is a fixed cost of 3 transactions per request?

I'm guessing you're using the
I'm guessing you're using the v2.s Leaflet plugin. Here is how I put markers on the map, fit to those markers, then displayed it all with one map transaction.   window.onload = function() { fg = L.featureGroup(); map ='map', { layers: fg, center: [38.895345, -77.030101], zoom: 15 }); fg.addLayer(L.marker([39.738453, -104.984853])); fg.addLayer(L.marker([39.749672, -105.216019])); map.fitBounds(fg.getBounds()); map.addLayer(MQ.mapLayer()); }