Google Maps on my Visual Force page doesn't show all markers as the number of results fetched

后端 未结 2 1030
逝去的感伤
逝去的感伤 2021-01-26 03:13

I am trying to develop a visual force page which shows \"Program Locations\". On page load it fetches all the programs and displays on the map using a marker. There are some fil

2条回答
  •  既然无缘
    2021-01-26 04:18

    You are running into the Geocoder error OVER_QUERY_LIMIT (from experience you can geocode approximately 11 addresses quickly before running into the rate limit). To verify add an else to the status check:

            geocoder.geocode({'address':address}, function (results, status) {
                if (status == google.maps.GeocoderStatus.OK) {
                    coords.push(results[0].geometry.location);
                } else alert("Geocode failed, status = "+status);
    

    Options:

    • geocode your addresses offline and use the coordinates to display the markers rather than the addresses
    • see this question on SO for a way to throttle the geocode requests

提交回复
热议问题