Web Services for Finding Stuff
Geolocation of “stuff” can be a pain. Once you get past geocoding addresses, you basically need a database of some kind, referencing a common key (business name, parcel ID, etc.) that can relate the search term to terra firma.
The problem them becomes one of time and complexity. Traditionally, spatial data is stored thematically - schools in one layer, business in another layer, libraries in another layer, ad infinitum. Taking a search term and banging it against a dozen layers makes for ugly code and long execution time.
Hence the advent of the “points of interest” layer, or “a compilation of largely unrelated crap, the only common denominator being the possibility somebody might want to search for it”.
You can certainly give a member of your staff the joyous task of randomly assembling this stuff, but it might not be necessary. There are several online services that can give you a helping hand, including offerings from Google and Yahoo! announced at the Where 2.0 conference and a collaborative creative commons licensed project.
Yahoo! seems to have the most comprehensive solution, dubbed the Yahoo! Internet Location Platform. James Fee has a great summary of this functionality with some code examples, but in a nutshell they assigned everything in their location database a unique ID (WOEID), and you can either search for a WOEID or a place name. For example:
- To search for the Sydney Opera House, you’d use:
- If you already knew the WOEID, you could just do this:
- And if you wanted to do a fuzzy search, you could do this:
Google has also just opened up outside access to its Geo Search API, which it calls Local Search. It’s very easy to integrate into a Google Maps mashup via the Local Search Control - just add in a map.addControl(new google.maps.LocalSearch()); to your code and you’re all set. This functionality was exposed at the Google Maps site, but now it’s available as a service as well. On the plus side, it’s dead simple to integrate with your Google Maps mashup. On the down side, it looks like that’s really the only way to use it, at least as far as I can grok from the docs.
Finally, if you need a little more flexibility or you would like to add some of your own locations to the list, check out GeoNames. From the web site:
The GeoNames geographical database is available for download free of charge under a creative commons attribution license. It contains over eight million geographical names and consists of 6.5 million unique features whereof 2.2 million populated places and 1.8 million alternate names. All features are categorized into one out of nine feature classes and further subcategorized into one out of 645 feature codes. (more statistics …).
The data is accessible free of charge through a number of webservices and a daily database export. GeoNames is already serving up to over 11 million web service requests per day. GeoNames is integrating geographical data such as names of places in various languages, elevation, population and others from various sources. All lat/long coordinates are in WGS84 (World Geodetic System 1984). Users may manually edit, correct and add new names using a user friendly wiki interface.
This is a really cool location service where users can add new names and make corrections to old one via a wiki. The site offers a host of web services you can access directly, and you can even download the current places database in a tab-delimited text file. They also have pre-built client libraries for Java, Ruby, Python, and others. If you need to add your own places to your place search database or contribute your own to the main list, this is a great way to go.
Data collection and digitization has been and continues to be the largest expense in the spatial world, not to mention onerous (and unfortunately under-appreciated) work. Taking advantage of services like these are a great way to minimize expense, and having so many eyes on the data tends to raise its overall quality. If you need to locate stuff, services like these are a great way to go.