jquery - Google Maps V3 plot multiple markers from array -
i'm trying plot markers array when use code below pops over_query_limit
$.each(obj , function(index, value){ geocoder = new google.maps.geocoder(); console.log(value); var replaced = value.tostring().replace(/\[.*\]/g,''); geocoder.geocode( { 'address': replaced}, function(results, status) { if (status == google.maps.geocoderstatus.ok) { map.setcenter(results[0].geometry.location); marker = new google.maps.marker({ map: map, position: results[0].geometry.location }); } else { alert('geocode not successful following reason: ' + status); } }); });
currently locations write array can't seem show besides copying part of console.log()
object { lagos=[2], almaty=[2], banten=[2], more...}
if convert array json show in it, shows below
{"lagos":[6.443663,3.419248],"almaty":[43.243819,76.947697],"banten":[43.257846,76.946418],"kuala":[3.15021,101.707703],"dubai":[24.9952447639,55.0559356887],"sharjah":[43.25819,76.946332],"esbjerg":[55.505168,8.456096],"brighouse":[53.6986,-1.76824],"burnley":[53.801334,-2.213863],"ipswich":[52.080412,1.118962],"daventry":[52.246678,-1.15401],"yarmouth":[52.595971,1.728609],"southampton":[50.93347,-1.505792],"cork":[51.807925,-8.370402],"gerenzano":[45.63942,8.998989],"stavanger":[58.99573462,5.6308005317],"sandnessjoen":[66.022204,12.631874],"glenugie":[57.486747,-1.800621],"wellbank":[57.484958,-1.813535],"cowdenbeath":[56.09946,-3.35909],"brisbane":[-27.46845,153.022642],"perth":[-31.955876,115.863018],"johns":[47.528329,-52.855225],"halifax":[44.644811,-63.569984],"edmonton":[53.50247,-113.425276],"kennesaw":[34.008442,-84.583408],"houston":[29.838801,-95.501597],"sanford":[35.443243,-79.177523],"cunupia":[10.571607,-61.398527],"maracaibo":[10.67676,-71.617362]}
my question how plot above latitudes , longitudes markers on map? current $.each()
method seems go on query limit per second.
thanks in advance
Comments
Post a Comment