Greenstone tutorial exercise

Back to wiki
Back to index
Prerequisite: A simple image collection
Sample files: images_gps.zip
Devised for Greenstone version: 3.06
Modified for Greenstone version: 3.08

An image collection with GPS metadata

In this tutorial, we'll be looking at building a collection that takes advantage of the GPS metadata embedded in image files. Using this data, we can plot the images on a map based on where they were taken.

  1. Create a new collection in GLI called Images-GPS. In the Gather panel, drag and drop the 4 folders in sample_files → images_gps from the Workspace view on the left into the Collection view on the right.

  1. Since the images are organised by folder, we can easily assign folder-level metadata to the images which will help with classifying them. In the Enrich panel, select the eiffel-tower folder, and in its dc.Title field type Eiffel Tower. Since this metadata is assigned at folder level, it is inherited as dc.Title metadata by all the images in the folder.

    When setting folder-level metadata like this, the default setting in GLI is to produce a popup window alerting you to the fact that the assigned metadata will be assigned to all files and sub-folders contained in the selected folder. For this collection, this is what we want, so press OK for the action to proceed.

    Note: if you prefer this popup not to appear each time you assign folder-level metadata, there is a tick-box in the lower left-hand corner of the popup window ("do not show this warning again") that allows you to control this. If you choose to suppress the popup, then it can be turned back on through File → Preferences and then clicking on the Warnings tab. The various options are alphabetically sorted, with the option that controls this popup: "About to add folder level metadata".

  1. Now select each of the remaining folders of images in turn, and assign the appropriate values for their dc.Title: Musée d'Orsay, Parc de Luxembourg and Panthéon district, respectively.

  1. Go to the Design panel. In the Browsing Classifiers section, choose AZCompactList from the select classifier to add dropdown box and press Add Classifier.... In the configuration dialog that appears, set the metadata field to dc.Title and tick the buttonname option and set its value to locations. This will create a classifier labelled locations that groups all images under Eiffel Tower into one bookshelf and similarly creates bookshelves for the other 3 categories.

  1. Now go to the Create panel and press Build Collection.

  1. Preview the collection and click the Locations tab in the web browser. Expand the bookshelf icons displayed in the web browser to see thumbnail pictures of the photos gathered under the displayed metadata heading. Explore further, and click on a thumbnail photo or two to view larger versions of the photos in the document view.

Extracting embedded metadata

  1. Each of these image files has metadata embedded in it—including GPS data—generated by the smartphone when the photo was taken. We can extract this metadata when the collection is built, and in particular, make use of the GPS metadata to provide map-based views of the collection to the user.

    In the Document Plugins section of the Design panel, go down to the select plugin to add and choose the EmbeddedMetadataPlugin. Press the Add Plugin button, and then click OK to add it to the plugin list. Select this plugin in the list, then use the Move Up button to shift it upwards until it comes just after the GreenstoneXMLPlugin.

  1. Go to the Create panel and press Build Collection.

  1. Now go to the Enrich panel, expand the eiffel-tower folder and select the first image. Scroll down to see the metadata extracted during the building process. Among the extracted metadata, you will find several pieces of Latitude and Longitude metadata, which we will be taking advantage of shortly: ex.Latitude, ex.Longitude, ex.LatShort, and ex.LngShort.

Adding in a map view to browsing

Greenstone has a map view, based on the Google Maps API, that can make use of this location metadata. The map view can be controlled to appear in different parts of the interface: as part of a collection's search results page when browsing the collection, and/or when viewing a document. For this view to be operational in a Greenstone, it is necessary for the collection to index the GPS metadata.

  1. In the Search Indexes section of the Design panel, press the New Index... button. Scroll down and tick the box for ex.LatShort and press Add Index to create an index on it. In like manner, create an index on ex.Latitude. Then another on ex.LngShort. And finally one on ex.Longitude.

  1. Select Search on the left of the Format panel. For the index on the combined longitude and latitude metadata, type locations as its display name.

  1. Now go to the Create panel and press Build Collection.

  1. To enable the map, go to the Format Features section of the Format panel, and select the browse format feature. In the editor below, enter the following format statement above the documentNode template:

    <gsf:option name="mapEnabled" value="true" />

  1. Also in the Format Features section, select the searchType feature. Add raw to the list of search types.

  1. In the Format panel press the Preview Collection button, and click on the new browsing classifier (locations) and then click on a bookshelf icon. The page that opens up shows a Google map, with the locations of the images in the collection pinpointed on it. The map view can also scroll through all the images, locating each place and associated image in turn.

By adding the <gsf:option name="mapEnabled" value="true" /> statement to the browse format feature, all of the classifiers built will have the map view enabled. It is also possible to activate the map view on individual classifiers, and on the search results page by adding the mapEnabled statement to the search format feature.

Adding in a map view to a document

  1. To activate a map view when viewing the document, go to the Format Features section of the Format panel, and select the display format feature. In the editor below, enter the following format statement after the line <gsf:option name="TOC" value="true" />:

    <gsf:option name="mapEnabled" value="true" />

  1. If you want the map to display nearby documents, then add the mapEnabled option to the search format feature also.

  1. Still in the Format panel press the Preview Collection button, browse or search to locate a document, and then view the document. The page that opens up shows a Google map, shows the location of the document (where the photo was taken), in addition to the screen-sized photo.


Copyright © 2005-2016 by the New Zealand Digital Library Project at the University of Waikato, New Zealand
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License.”