The Magical History Tour – Mashing up Google Latitude, Tropo and historical info
The avatar you see on the map is for John Paul Jones, and it’s parked in front of the John Paul Jones House in Portsmouth, New Hampshire. If Admiral Jones were still alive, he could dial my Moveble History app, and let Wikipedia read to him about the house that bears his name . He could then press any key to hear about the next closest site, from the National Register of Historic Places (NRHP). But since he’s not, we’ll just let him stay parked there to offer a demo to any passing Internet visitor.
This mashup follows the “moveable” paradigm I first laid out with Moveable Weather, and followed with Moveable Tides. The basic components are Google Latitude, Voxeo Tropo, and a geotagged dataset, in this case a download of the NRHP, which we pump up by loading into a geohash.
The user interface for this mashup is extremely simple: If the user doesn’t change location between clicks, then each time he presses a key, the proximity search will cast a wider net, to find historic places that are further and further distant. However, if he does move, then the proximity searches will begin from the new location. Plunk your Google Latitude avatar down in Times Square, or Gettysburg, and starting learning about the history around you.
I invite you to explore my source code, with associated wiki, to learn more. I’d like to give a special shout out to some of my favorite programming tools, including
- XSLT for wrestling XML into submission
- the geomodel Python module, for performing proximity searches
- the BeautifulSoup Python module, for wading into heavily marked-up HTML, to emerge with clean text for Tropo to pronounce
Finally, I leave you with a bit of Python code, which shows how you can get Voxeo to talk about distances in a kindler, gentler fashion, for your users:
def get_sayable_distance (self, distance): miles = (distance/1000) * .62 num_miles = "%.0f" % miles num_miles = int (num_miles) fraction = miles - num_miles if (num_miles == 1): mile_sing_plur = "mile" else: mile_sing_plur = "miles" if ((fraction < .15) and (num_miles < 1)): feet = miles * 5280 feet = "%.0f" % feet return "about %s feet" % feet else: if (fraction < .15): fraction_part = '' if (fraction > .15): fraction_part = "a quarter" if (fraction > .35): fraction_part = "a half" if (fraction > .65): fraction_part = "three quarters" if (fraction > .90): fraction_part = "" num_miles = num_miles 1 if (num_miles): if (fraction_part): say_miles = "%s and %s %s" % (num_miles, fraction_part, mile_sing_plur) else: say_miles = "%s %s" % (num_miles, mile_sing_plur) else: if (fraction_part == "a half"): say_miles = "a half a mile" elif (fraction_part == "a quarter"): say_miles = "a quarter of a mile" elif (fraction_part == "three quarters"): say_miles = "three quarters of a mile" say_miles = "about %s" % say_miles return say_miles
Originally from Voxeo Blogs

Leave a Reply