map = new GMaps({
div: '#gmap_marker',
lat: 43.921493,
lng: 12.337646,
});
var jsonData = {
"status":"success",
"results":[
{
"customerId":1,
"address":"Via Italia 43, Milano (MI)",
"customerName":"MyAwesomeCustomer1"
},
{
"customerId":2,
"address":"Via Roma 10, Roma (RM)",
"customerName":"MyAwesomeCustomer2"
}
]
};
\t \t \t
function loadMarkerTimeout(timeout) {
setTimeout(loadMarker, timeout)
}
function loadMarker() { \t
map.setZoom(6);
$.ajax({
url: '/echo/html/',
type: "POST",
data: jsonData,
cache: false,
success:function(result){
var res=JSON.parse(result);
if(res.status == 'success') {
resNumber = res.results.length;
//Call the geoCoder function
getGeoCodeFor(map, res.results);
}
}//success
});//ajax
};//loadMarker()
$().ready(function(e) {
loadMarker();
});
//Geocoder function
function getGeoCodeFor(maps, addresses) {
$.each(addresses, function(i,e){ \t \t \t \t
GMaps.geocode({
address: e.address,
callback: function(results, status) {
geocode_count++; \t \t
console.log('Id: '+e.customerId+' | Status: '+status);
if (status == 'OK') { \t \t
//if the element is alreay in the array, remove it
lost_addresses = jQuery.grep(lost_addresses, function(value) {
return value != e;
});
latlng = results[0].geometry.location;
map.addMarker({
lat: latlng.lat(),
lng: latlng.lng(),
title: e.customerName,
});//addMarker
} else if (status == 'ZERO_RESULTS') {
//alert('Sorry, no results found');
} else if(status == 'OVER_QUERY_LIMIT') {
//if the element is not in the losts_addresses array, add it!
if(jQuery.inArray(e,lost_addresses) == -1) {
lost_addresses.push(e);
}
}
if(geocode_count == addresses.length) {
//set counter == 0 so it wont's stop next round
geocode_count = 0;
setTimeout(function() {
getGeoCodeFor(maps, lost_addresses);
}, 2500);
}
}//callback
});//GeoCode
});//each
};//getGeoCodeFor()
#gmap_marker {
min-height:250px;
height:100%;
width:100%;
position: relative;
overflow: hidden;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://maps.google.com/maps/api/js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gmaps.js/0.4.24/gmaps.min.js" type="text/javascript"></script>
<div id="gmap_marker"></div> <!-- /#gmap_marker -->
nasıl coğrafi kodlama sunucusunu sorguluyorsunuz? Bazı kodları göster. – keune
Buraya bak: http://stackoverflow.com/questions/16659398/google-maps-over-query-limit ait – user2403424
Olası kopyalar [AŞIRI \ _QUERY \ _LIMIT google haritalar kullanırken] (http: // stackoverflow .com/questions/3529746/over-query-limit-while-using-google-haritalar) – xomena