Skip to content

Instantly share code, notes, and snippets.

@onlinemad
Created February 17, 2016 03:13
Show Gist options
  • Save onlinemad/7cd8c1ff3b2192387029 to your computer and use it in GitHub Desktop.
Save onlinemad/7cd8c1ff3b2192387029 to your computer and use it in GitHub Desktop.
function geocoding(lat, lng) {
// Gets the address of a point in Times Square.
Utilities.sleep(1000);
var response = Maps.newGeocoder().setLanguage('zh_TW').reverseGeocode(lat, lng);
var r = response.results[0];
for (var j = 0; j < r.address_components.length; j++) {
var comp = r.address_components[j];;
if (comp.types[0] === 'administrative_area_level_1') {
return comp.long_name;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment