joshuabowers / gun_fail

A Google Maps visualization of Daily Kos' GunFail series
0 stars 0 forks source link

Switch to Google's Geocoding and Timezone APIs #2

Closed joshuabowers closed 11 years ago

joshuabowers commented 11 years ago

Google's APIs for geocoding and timezones is a lot nicer than geonames: cleaner, easier to use, and a hell of a lot more accurate. Shouldn't be terribly difficult to switch over to using them. The usage rates are not bad, and if my searches are accurate, I should be able to cache the results as long as I only use them with google maps. Which is the intent.

joshuabowers commented 11 years ago

(Extracted from a comment on a previous commit.)

This needs to be slightly more robust: for example, a location within Miami-Dade County will eventually bubble up to the county (administrative_area_level_2) level; currently, a geocoded search for "miami-dade county" tends to return, as first result, the locality of Miami, despite the "county" suffix. Interestingly, the result set does contain two elements: in addition to the locality entry, a secondary entry exists for the county itself. Therefore, the logical approach would be to alter #geocode to filter results based on an optional type parameter; if the parameter is present, it would dictate which types of records would be selected. Doing this, continuous search loops should be avoidable: if a result set does not return a result of the searched type, then raise an exception, thus breaking out of the recursion.

joshuabowers commented 11 years ago

While more work yet need be done (specifically, there are still the odd outlier in the incident scraper script which need to be fixed, and the map UI does not attempt to aggregate incidents within a location), the system is now officially running on Google's APIs, rather than upon geonames.