Login

Snippets by whardeman

Snippet List

Retrieve Latitude & Longitude for an Address from Google Geocoder V3

Very simple python class for querying Google Geocoder. Accepts a human-readable address, parses JSON results and sets lat and lng. (Full JSON results are stored to `results` property of GoogleLatLng for access to other attributes.) This could easily be expanded to include the XML output option, etc. **Requires PycURL and simplejson.** Example: >>> location = "1600 Amphitheatre Parkway, Mountain View, CA 94043" >>> glatlng = GoogleLatLng() >>> glatlng.requestLatLngJSON(location) >>> print "Latitude: %s, Longitude: %s" % (glatlng.lat, glatlng.lng) Latitude: 37.422782, Longitude: -122.085099` ** Do not forget the usage limits, which include request rate throttling, otherwise, Google might ban you. ** ===

  • google
  • geocode
Read More

whardeman has posted 1 snippet.