Blog
Virtual guide mashup
2009-01-07 18:41:14 by Martynas Jusevičius
Some time ago I was asked to put online a simple business card-like website with information about guide services. I came up with the idea to illustrate the real guide service with a virtual guide service, that is, to present notable places of interest on an interactive map. And here is the result: www.guideservice.lt. While it still is in early stages, the technical solution could be interesting to some.
Basically, the website is a mashup based on Google Maps and DBpedia and implemented in JavaScript and SPARQL. Using Lee Feigenbaum's SPARQL client and about 50 lines of JavaScript code, it queries DBpedia's (which is semantically converted Wikipedia) SPARQL endpoint for resources that have geographical coordinates within the bounds of the map, and sets up to a 100 of them as markers on the map. When clicked, the marker opens an info window with title, description, and/or picture of the object. In that way one can virtually explore the area.
This release has several known bugs. Sometimes the request to DBpedia time-outs, and no markers are shown. Another issue is too many markers on the screen which after a while becomes pretty slow.
Does anyone know a way to remove markers that appear out of the map bounds? Currently it is done by simply calling clearOverlays() after the map is moved, but it also closes open info windows.
I think this illustrates well how simple yet powerful DBpedia and SPARQL are. On the other hand, it also proves the need for higher-level semantics. For example, Galle is shown as a place in Lithuania, when in fact it is a crater... on the Moon :)
Comments (3)
In my google maps applications I use the following techniques.
1) I track the markers in a hash (not an array...with the hash you can tell very quickly which markers from your query on already on your map and which ones are not). This way you can remove markers individually with GMap2.removeOverlay()
2) I query for markers in an extended boundary so that every move of the map does not result in a query.
3) I use a marker manager object who knows which markers on on the map and which are not. It removes the ones from the map which are not in display, and renders the ones which are.
4) I also use server side clustering. This might not be possible in your situation unless you write a php proxy, i guess. You can also try a client side clustering option
2)
Few ideas & bugs
Instead of showing a lot of markets generate a window with a list of titles that are visible in the screen.
There is a marker for Vilnius city. It has a missing picture.
When you click on a link to wikipedia and then go back you loose your previous view of the map. This could be solved using ajax and sessions i guess.
All in all a really nice idea. If there would be some descriptions pulled out from wikipedia instead of a link it would be even more great ;)
to Žilvinas
Descriptions and pictures are shown if provided by DBpedia. However, it is not a real-time copy of Wikipedia, so there can be mismatches.
If a picture missing, I guess the link is simply broken, and there is not much to do about it, at least in JavaScript.

Too many markers
2009-01-07 20:51:52 by Avi