LibMap

Introduction

If you have lots of library sites to manage, and you want to keep your website up-to-date with all the changes that may occur at individual libraries, what better way than to change the data in one place, and see the updates cascaded across your whole site.

With the aid of the Talis Silkworm Directory, and minimal xhtml and javascript this is becoming a reality. You can even encourage your libraries to update the data themselves as soon as they spot something is wrong. Emergency closure? no problem, you will soon be able to add and edit opening times on the directory and have these details available to your users as soon as you have submitted the changes.

In this, my first foray into using the Silkworm Directory, I introduce the LibMap. All you have to do is edit 3 files, with information specific to your library setup, and the rest will happen through the magic of javascript.

Example

The getlibraries script can be seen inaction here on the Herefordshire Libraries website (unfortunately this is no longer live as they did not renew their hosting and moved everything to a corporate CMS, much boo-hooing).

The first thing you see is a google map with little markers where your libraries are. Click on a marker, and a bubble opens with a closeup of the library location, along with further contact information.

LibMap - showing Ledbury Library's location information

There is also an [edit] link which will take you directly into the silkworm directory and show you a page for that location. Assuming you have a user login with the directory, you can edit anything that is wrong and it will be reflected in the map within moments.

Technical

The Libmap uses a Talis Platform API for the Silkworm Directory, to gather information about a collection’s library locations. This data is then displayed on a google map. The script can cope with multiple locations, single locations, and no locations, and includes links back to the directory to allow users to edit any information that they see is incorrect.

Javascript runs in the client browser, so that serverside proxies and server side languages are not required.

The Future

In future versions of the script – some of which I am working on at the moment, I intend to have a vcard (the electronic business cards that Microsoft Outlook and other programs use) embedded within the bubble so that it can be downloaded and added to outlook’s contacts with an easy click of a link. Presently this doesn’t appear to be possible purely using javascript. and as one of the design goals was to NOT use any sort of proxy requiring particular environments…

With the Silkworm Directory, there is great possibility for further extracting your information from the directory to dynamically build page information. As soon as the directory includes opening time data (which I’m reliably informed is soon which is now!), I will be updating our website with pages for individual libraries, where the bulk of the information is drawn from the directory, allowing our users to see the same information across all areas of the site, whether it be on a map or on a web page.

Installation

  1. Download getlibraries version 2
  2. The text file simply contains the query, and you will need to pop your library’s identifier in there. This identifier is that used by Silkworm to identify your library COLLECTION. You will need to make sure that your library collection is present in the directory and that you have added locations to the collection.
  3. The js file will need your Talis API key, and the path to getlibraries-v2-sparql.txt
  4. upload these to your server.
  5. Add a script tag in your html page with the getlibraries-v2.js as the src attribute.
  6. Remember that you need to have a google maps API key and script tag in your html header – see http://www.google.com/apis/maps/.
  7. Add a div to your page with attribute id=”map”. You will probably want to add a style attribute too, with the width and height defined. If you have any old maps (as we did in herefordshire) that are based on an image, you can simply encapsulate the old markup in a noscript tag, which will serve for browsers that don’t like javascript.

Comments and help

If you want to let me know how you get on with this script, or if you have questions to ask, please feel free.

If you actually use this script I would love to know!

Technorati Tags: , , , , , ,