simple point and search with a maps API [Sat, 07 Jan 2012 16:29:10 +0000]
I'm currently working with some folks on a pilot project to build a shared index of digital collection metadata from libraries in North Carolina. My part entails harvesting the metadata and indexing it with Solr.
Since most of the stuff is North Carolina centric, I thought it might be neat to use the API that the index will have to drag a marker on a map and then use the marker location to send a search to the index. My co-worker also wants to do something similar so people can search using a map marker for a project of hers. So, I thought I'd investigate.
I wanted to see how easy it was to do this with the Google Maps API and, well, it is pretty easy. Especially, since I found this [http://gmaps-samples-v3.googlecode.com/svn/trunk/draggable-markers/draggable-markers.html] marker dragging example.
There's lot of stuff that can be done, like dynamically populating the page with a set of results via AJAX but for now I'm just using the city name plus a pre-written string to create a search string that the user has to manually click.
In the little example I made [http://blog.humaneguitarist.org/uploads/SC_restaurantSearchViaMap.html] (below), I'm using my home state of South Carolina. If you move the marker within SC and drop it, a simple search string is created for sending a search, ironically, to Bing Maps for the term "restaurants" and that city.
I think a search like this is really for fun, but it might be a nice way to search and learn a little geography along the way. I've also got an idea for a game using this kind of search that's sort of a spin on Concentration for digital collections, but I'll write that up later. I'm hungry and need to start enjoying my Saturday. Looking at these restaurants searches is making me even hungrier.