Blog Posts from Library Technology Guides

GuidePosts

Perspective and commentary by Marshall Breeding

New Map Feature in lib-web-cats

lib-web-cats now has the ability to display maps with multiple library locations that can be generated internally, or through links embedded in external pages. This map facility is based on the Google Map API Version 3 and geographic coordinates stored in library records in lib-web-cats. These coordinates have been pre-populated for libraries in the United States using the Google API or the USGS geocoder Web service. Iím still in the process of adding coordinates for other libraries.

lib-web-cats has had the ability to display maps for individual libraries for quite some time. The display of each library automatically presents a map of the library location if the coordinates of the library have been recorded. For those without coordinates, a button is presented that launches a pop-up window that attempts to display a map based on a dynamic calculation of the geographic coordinates from its street address.

Creating and Linking to Maps

Libraries that would like to present a map of the libraries in their system or in their geographic area can link to these maps and avoid some of the complexities of generating maps on their own sites.

One way to use the map is through the lib-web-cats pages for your library. Each map presented through lib-web-cats includes a permalink at the bottom that is a persistent URL that can be used to link to the map. Do not just copy the link from what shows in your browser since it might contain extraneous session information.

For libraries in the United States, lib-web-cats can reliably generate maps for every city and county in every state, as well as most library consortia. lib-web-cats will present links to display these maps in library listings. Look for the map symbol: which links to the appropriate map.

You can also create a map by manually constructing the URL that you want to put on your page. Such a URL includes the base URL for Library Technology Guides (http://www.librarytechnology.org/), the map script (map.pl), a question mark (?),and one or more sets of name/value pairs that represent the query that will return the list of libraries you want. Query term supported include: Country, State, County, City, Institution, OrgName, Consortia, Type, ILS, and AltOPAC (discovery interface). Each set of name/value pairs should be separated by the UTF-8 representation of the amberstand (&amp;). Example: http://www.librarytechnology.org/map.pl?State=Massachusetts&Type=Public&ILS=Unicorn.
To qualify members of the Association of Research Libraries use ARL=on, Members of the Urban Libraries Council ULS=on, libraries offering public wireless access WiFi=on. If you have any questions on how to construct the link to display the map you want, just ask me.

Limitations.The placement of libraries on the maps depend on accurate coordinate data. lib-web-cats may have missing or inaccurate data for some libraries. If you find that libraries do not display or display in an incorrect location, you will need to update the entry for that library accordingly. Registered users of Library Technology Guides can log in and update entries (all changes are logged and monitored). An easy way to determine the coordinates of a library is to find the library in Google Maps, zoom in to the maximum level, center the map on your library, and then copy the url associated with the "link" option in the upper right corner. Paste this URL into notepad or some other editing space. The "ll" parameter of this url gives the decimal representation of the longitude and latitude of the library, which can then be pasted into the lib-web-cats record. You can also use any GPS device to capture the coordinates. lib-web-cats can accept coordinates given in degrees, which are automatically converted into decimal.

Maps of library locations on a campus may be of particular interest. Currently many of the academic libraries lack accurate coordinates. But using the methods described above, you should be able to easily create an accurate map that displays all the campus library locations.

Technical details

The lib-web-cats map facility combines data from its own database, the Google Map API, and performs a variety of calculations to display each map. The display of a map using the Google API requires several different data elements, including the coordinates on which the map should be centered, the zoom level that should be applied, the coordinates of each pin location, and information to populate the descriptive pop-up window. The perl script that generates the map initially runs the query for the libraries requested for display and retrieves the geographic coordinates. It identifies the minimum and maximum values for each latitude and longitude. The mid-point between the minimum and maximum values are passed to the map API as the center position of the map. The script calculates the difference between the minimum and maximum levels, and uses the scale of the difference to assign a zoom level. With the center point and zoom values, the basic map can be requested from the Google API. Next, the script fetches values for each library, including its coordinates, name, address, and photo. These data are used to place the pin, and populate the informational window.

The presentation of each map involves a fairly large number of database transactions and calculations, but for most maps the load time is quick. Maps that involve several hundreds of libraries will take a bit longer to load. I've currently set the maximum number of libraries per map at 2,000.

Feedback Appreciated

I hope that those that use lib-web-cats will find the new mapping feature to be helpful. Feel free to link to any of the maps. And please send my any suggestions that you might have on ways to make it more useful and interesting. If you run into errors, or if you find libraries with incorrect coordinates, please report those to me.