These examples illustrate how you can use the Pelagios API in your own Web mashups and applications. The examples require knowledge of JavaScript, and it helps if you have used a Web mapping library before. But otherwise, things should Just Work.
If you have a GitHub account, clone this repository. Otherwise, download the whole project as a Zip, and unpack at a convenient location. There are two examples in the project:
This example uses the search functionality of the Pelagios API to retrieve objects and map their geographical outlines on a map. Most objects on the Pelagios API have a "footprint" of just a single coordinate (e.g. because they are archaeological items, coins, etc.). But the literary works from the Pelagios 3 collection typically cover a larger area.
The example searches the API for the terms 'Homer' and 'Herodotus', grabs the search results' convex hulls from the JSON responses and overlays them on map in different colours in order to visualize their different spatial focus. The example uses the Leaflet Web mapping library, along with suitable base layer maps developed by the Digital Atlas of the Roman Empire and the Ancient World Mapping Center.
Open the file tutorial-map.html
with your browser to run the example. The relevant code to look at & tweak
is in the file tutorial-map.js.
The second example uses the API to fetch objects that match the search query 'bronze AND coin', and which are dated between 700 BC and 800 AD. The objects' timestamps (either a single year or an interval) are then used to construct an interactive timeline, using the vis.js visualization library.
Open the file tutorial-timeline.html
with your browser to run the example. Relevant code is
in the file tutorial-timeline.js.
This examples retrieves the places mentioned in a single document, and constructs a graph from how the places occur in the text (again using the vis.js visualization library). Places are connected if they appear adjacent in the text. This way, the graph shows their sequence, but also how more frequently referenced places become more central in the network.
Some things you could do next:
-
Try playing around with the features of the Pelagios API. For example: try plotting the footprints of all datasets; improve map popups, so that they link back to the original source of the data; make use of the thumbnail URLs included with some of our objects; are there any other datasets you know of you could mash up with Pelagios API?
-
Try different visualization approaches & tools. E.g.: how about visualizing search results in GeoTemCo?
-
Come up with something cool? Have more ideas? Let us know!