Created
January 10, 2013 18:17
-
-
Save danielrobbins/4504433 to your computer and use it in GitHub Desktop.
may fix ZEN-2971
error at geocoding addresses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: /trunk/core/Products/ZenWidgets/skins/zenui/javascript/geomap.js | |
=================================================================== | |
--- /trunk/core/Products/ZenWidgets/skins/zenui/javascript/geomap.js (revision 62520) | |
+++ /trunk/core/Products/ZenWidgets/skins/zenui/javascript/geomap.js (revision 62633) | |
@@ -105,5 +105,5 @@ | |
this error when the user has reached their daily limit for their IP as well. | |
*/ | |
- errorCount++; | |
+ errorCount++; | |
if(errorCount >= 5){ | |
_utils.statusDialog("QUERY_LIMIT error. If this is a free account, you may have reached your daily limit. Please try again later."); | |
@@ -111,4 +111,29 @@ | |
} | |
setTimeout(function(){_overlay.addMarkers()}, 2000); | |
+ }else if(status === google.maps.GeocoderStatus.ZERO_RESULTS){ | |
+ try{var latlngStr = nodedata[index][0].split(",",2);}catch(e){ | |
+ _utils.statusDialog("There was a problem with the address entered. Please check it and try again"); | |
+ dialog.style.display = 'block'; | |
+ dialog.innerHTML = ""; | |
+ } | |
+ var lat = parseFloat(latlngStr[0]); | |
+ var lng = parseFloat(latlngStr[1]); | |
+ var latlng = new google.maps.LatLng(lat, lng); | |
+ geocoder.geocode({'latLng': latlng}, function(results, status) { | |
+ if (status == google.maps.GeocoderStatus.OK) { | |
+ if(results[1]){ | |
+ nodes.push(results[1]); | |
+ dialog.style.display = 'block'; | |
+ var content = "Geocoding " + (index+1) + " of " + nodedata.length + " addresses, please wait...<br><br>"; | |
+ content += '<img src="http://us.i1.yimg.com/us.yimg.com/i/us/per/gr/gp/rel_interstitial_loading.gif" />'; | |
+ dialog.innerHTML = content; | |
+ _overlay.constructMarker(results[1], true); | |
+ } | |
+ }else{ | |
+ _utils.statusDialog("We tried the address but couldn't find anything. Maybe try a different address?"); | |
+ dialog.style.display = 'block'; | |
+ dialog.innerHTML = ""; | |
+ } | |
+ }); | |
}else{ | |
_utils.statusDialog(status); | |
@@ -157,4 +182,6 @@ | |
} | |
}); | |
+ }else if(status === google.maps.GeocoderStatus.ZERO_RESULTS){ | |
+ _utils.statusDialog("There was a problem with one of the connecting addresses, moving on..."); | |
}else if(status === google.maps.GeocoderStatus.OVER_QUERY_LIMIT) { | |
/* try the address a few times after some delay to make sure it really is a query limit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment