Hack 24. Search for Events by Location

Events listed in the EVDB event database can easily be plotted on a Google Map.

Using a generic search engine isn't a good way to find out about events such as musical performances or garage sales. You can't specify that only event descriptions are wanted, and even if you could, the results aren't displayed in a way that organizes them usefully in time and space.

Wouldn't you like to be able to type keywords ("U2", "pug meetup", etc.) into a specialized event service, and get back not only a list of textual descriptions, but also a map showing event locations and a calendar highlighting event dates? Well, that's what EVMapper does. You can try EVMapper for yourself at http://mapbureau.com/evmapper/. Figure 3-15 is a screenshot of the results of the "pug meetup" search.

Figure 3-15. Pug meetup locations

You can click on a map dot, or an event listing, or a highlighted calendar date, and details about the event at that place or time will be displayed. If there is more than one, a list is displayed instead. Whenever an event is selected, and however the selection took place, its location will be marked on the map by the big balloon and its date will be marked by a little red square on the calendar. You can also click your way through the events in time.

3.9.1. How It Works

EVMapper is a mashup of two services: EVDB and Google Maps. EVDB (http://evdb.com) is the Events and Venues Database, a free site that allows anyone to submit or search for events. An EVDB search displays a list of events; events can also be organized into personal calendars. However, maps are not currently part of the experience at the EVDB site.

EVDB provides a RESTful API to the event database (http://api.evdb.com). When a user enters a query into EVMapper, an /events/search call is made to the API; for example:

http://api.evdb.com/rest/events/search?app_key=…&keywords=pug+meetup

The XML returned by EVDB contains descriptions of the matching events. The descriptions specify place by name (e.g., city, state, and sometimes ZIP Code or street address), not latitude/longitude, so EVMapper needs to do the geocoding. EVMapper implements the simplest possible geocoding method, which is adequate to demonstrate the idea of event mapping: it looks up city/state in a GNIS database covering the United States only. The Geographic Names Information System is the official repository of place names in the United States. You can query the GNIS at http://geonames.usgs.gov/. As of this writing, EVDB has recently begun to provide lat/long coordinates with some event descriptions, and EVMapper will soon exploit this development with dispatch.

EVMapper uses RDF, rather than EVDB's specialized XML, for its internal data. RDF makes EVMapper's representation and processing of events fully extensible, since RDF is built from an open-ended series of vocabularies, each for its own application domain. RDF datasets freely mingle vocabularies for as many domains as are relevant to the application at hand. In future, EVMapper may aggregate events from a variety of sources, not just EVDB. New bits of RDF vocabulary, asserting things like tonnage of ships for shipwrecks or Richter Scale values for earthquakes, will be added as needed, with no need to disturb the underlying implementation. Of course, translators from other formats may be required, as was the case for EVDB.

EVMapper is implemented in Fabl (http://fabl.net), a programming language for which RDF is the native data representation.

3.9.2. See Also

Категории