Quantcast
Channel: Information Takes Over » AJAX
Viewing all articles
Browse latest Browse all 2

A Multi-library Google Map – getlibraries

$
0
0

It’s been quiet here at ITO while I get on with little things like a dissertation. As a reward for days spent reading schema documents, I have been having a fiddle with Google maps and the Silkworm directory from Talis.

Here’s wot I got… getlibraries LibMap – sounds better!
A multi-library google map – the map in action on a real page!

Firstly, there’s one javascript file which when called from a web page using an xhtml script tag will form a query with your parameters and send it to the TPA SPARQL endpoint. the result is fired and recieved at the same time using Dynode style cross-domain scripting method (I didn’t use the dynode script, just the essense of the technique). The Parameters that you can set within the .js file are as follows:

  • key = Talis Api Key
  • identifier = identifier of a libraries collection (with more than one library*) from the Silkworm directory.
  • xsl = the URL to the XSL stylesheet explained next.

*At the moment the script will not cope with a single location, but I’m working on that.

Secondly, there’s one XSLT file which is submitted along with a SPARQL request to the Talis Platform Api (TPA) SPARQL endpoint. This reformats the RDF output into a javascript file that encapsulates the data as a JSON object, invokes a new map container and iterates through the JSON object, showing details for all libraries found by the SPARQL query.

Thirdly – and lastly, there is a small amount of code to go IN your web page, whatever your webpage may be. first is a script tag, which points to getlibraries.js. the second is a DIV tag with an id=”map” attribute. You can also set the height and width attributes to define the size of container that Google Maps will use. More instructions are in the .js file.
And that is it!

the getlibraries.js script writes another script tag that calls the data from the TPA. The javascript file can be edited to include your TPA key, the silkworm identifier for your library and the location of your copy of the XSLT file.

  1. Put the code in your page
  2. Edit the js file
  3. Put the js and xsl files on your server
  4. Job done!

I don’t for a moment think it worthy of the Mashuing Up The Library competition, but give it a go and let me know!

A note on browsers – I have tested this in Firefox 1.5.0.4 and in IE 6. It would be interesting to know if there are any problems with other browsers?

Download here… getlibraries.zip

Technorati Tags: , , , , , ,


Viewing all articles
Browse latest Browse all 2

Trending Articles