Skip to content

Navigation by Chronology

Cookbook URLs
Recipe: https://iiif.io/api/cookbook/recipe/0230-navdate/
JSON-LD Example 1 - 1986 Map: https://iiif.io/api/cookbook/recipe/0230-navdate/navdate_map_2-manifest.json
JSON-LD Example 2 - 1987 Map: https://iiif.io/api/cookbook/recipe/0230-navdate/navdate_map_1-manifest.json
JSON-LD Example 3 - Collection: https://iiif.io/api/cookbook/recipe/0230-navdate/navdate-collection.json

Method 1 - Setting the navDate property during object construction using a datetime object

Example 1 - 1986 Map

from iiif_prezi3 import Manifest, config
from datetime import datetime, timezone

config.configs['helpers.auto_fields.AutoLang'].auto_lang = "en"

# n.b: You MUST set `tzinfo` as the Prezi3 Specification requires a timezone, and the default `datetime` does not have one.
manifest = Manifest(id="https://iiif.io/api/cookbook/recipe/0230-navdate/navdate_map_2-manifest.json",
                    label="1986 Chesapeake and Ohio Canal, Washington, D.C., Maryland, West Virginia, official map and guide",
                    navDate=datetime(1986, 1, 1, tzinfo=timezone.utc))
canvas = manifest.make_canvas_from_iiif(url="https://iiif.io/api/image/3.0/example/reference/43153e2ec7531f14dd1c9b2fc401678a-87691274-1986",
                                        id="https://iiif.io/api/cookbook/recipe/0230-navdate/canvas/p1",
                                        label="1986 Map, recto and verso, with a date of publication",
                                        anno_id="https://iiif.io/api/cookbook/recipe/0230-navdate/annotation/p0001-image",
                                        anno_page_id="https://iiif.io/api/cookbook/recipe/0230-navdate/page/p1/1")

# This is a workaround for an inconsistency in the Cookbook JSON - see https://github.com/IIIF/cookbook-recipes/issues/376
canvas.items[0].items[0].body.service[0].id = "https://iiif.io/api/image/3.0/example/reference/43153e2ec7531f14dd1c9b2fc401678a-87691274-1986/"

print(manifest.json(indent=2))

Example 2 - 1987 Map

from iiif_prezi3 import Manifest, config
from datetime import datetime, timezone

config.configs['helpers.auto_fields.AutoLang'].auto_lang = "en"

# n.b: You MUST set `tzinfo` as the Prezi3 Specification requires a timezone, and the default `datetime` does not have one.
manifest = Manifest(id="https://iiif.io/api/cookbook/recipe/0230-navdate/navdate_map_1-manifest.json",
                    label="1987 Chesapeake and Ohio Canal, Washington, D.C., Maryland, West Virginia, official map and guide",
                    navDate=datetime(1987, 1, 1, tzinfo=timezone.utc))
canvas = manifest.make_canvas_from_iiif(url="https://iiif.io/api/image/3.0/example/reference/43153e2ec7531f14dd1c9b2fc401678a-88695674",
                                        id="https://iiif.io/api/cookbook/recipe/0230-navdate/canvas/p1",
                                        label="1987 Map, recto and verso, with a date of publication",
                                        anno_id="https://iiif.io/api/cookbook/recipe/0230-navdate/annotation/p0001-image",
                                        anno_page_id="https://iiif.io/api/cookbook/recipe/0230-navdate/page/p1/1")

# This is a workaround for an inconsistency in the Cookbook JSON - see https://github.com/IIIF/cookbook-recipes/issues/376
canvas.items[0].items[0].body.service[0].id = "https://iiif.io/api/image/3.0/example/reference/43153e2ec7531f14dd1c9b2fc401678a-88695674/"

print(manifest.json(indent=2))

Example 3 - Collection

Here we can make use of the fact that iiif-prezi3 will automatically turn a Manifest into a reference when it is added to a Collection object.

from iiif_prezi3 import Collection, Manifest, ResourceItem, config
from datetime import datetime, timezone

config.configs['helpers.auto_fields.AutoLang'].auto_lang = "en"

# n.b: You MUST set `tzinfo` as the Prezi3 Specification requires a timezone, and the default `datetime` does not have one.
manifest1986 = Manifest(id="https://iiif.io/api/cookbook/recipe/0230-navdate/navdate_map_2-manifest.json",
                        label="1986 Chesapeake and Ohio Canal, Washington, D.C., Maryland, West Virginia, official map and guide",
                        navDate=datetime(1986, 1, 1, tzinfo=timezone.utc))
canvas1986 = manifest1986.make_canvas_from_iiif(url="https://iiif.io/api/image/3.0/example/reference/43153e2ec7531f14dd1c9b2fc401678a-87691274-1986",
                                                id="https://iiif.io/api/cookbook/recipe/0230-navdate/canvas/p1",
                                                label="1986 Map, recto and verso, with a date of publication",
                                                anno_id="https://iiif.io/api/cookbook/recipe/0230-navdate/annotation/p0001-image",
                                                anno_page_id="https://iiif.io/api/cookbook/recipe/0230-navdate/page/p1/1")

manifest1987 = Manifest(id="https://iiif.io/api/cookbook/recipe/0230-navdate/navdate_map_1-manifest.json",
                        label="1987 Chesapeake and Ohio Canal, Washington, D.C., Maryland, West Virginia, official map and guide",
                        navDate=datetime(1987, 1, 1, tzinfo=timezone.utc))
canvas1987 = manifest1987.make_canvas_from_iiif(url="https://iiif.io/api/image/3.0/example/reference/43153e2ec7531f14dd1c9b2fc401678a-88695674",
                                                id="https://iiif.io/api/cookbook/recipe/0230-navdate/canvas/p1",
                                                label="1987 Map, recto and verso, with a date of publication",
                                                anno_id="https://iiif.io/api/cookbook/recipe/0230-navdate/annotation/p0001-image",
                                                anno_page_id="https://iiif.io/api/cookbook/recipe/0230-navdate/page/p1/1")

collection = Collection(id="https://iiif.io/api/cookbook/recipe/0230-navdate/navdate-collection.json",
                        label="Chesapeake and Ohio Canal map and guide pamphlets")
thumbnail = ResourceItem(id="https://iiif.io/api/image/3.0/example/reference/43153e2ec7531f14dd1c9b2fc401678a-88695674/full/max/0/default.jpg",
                         type="Image",
                         format="image/jpeg",
                         height=300,
                         width=221)
thumbnail.make_service(id="https://iiif.io/api/image/3.0/example/reference/43153e2ec7531f14dd1c9b2fc401678a-88695674",
                       type="ImageService3",
                       profile="level1")
collection.thumbnail = [thumbnail]

collection.add_item(manifest1986)
collection.add_item(manifest1987)
collection.items[0].navDate = manifest1986.navDate
collection.items[1].navDate = manifest1987.navDate

print(collection.json(indent=2))

Method 2 - Setting the navDate property with a string

Example 1 - 1986 Map

from iiif_prezi3 import Manifest, config

config.configs['helpers.auto_fields.AutoLang'].auto_lang = "en"

manifest = Manifest(id="https://iiif.io/api/cookbook/recipe/0230-navdate/navdate_map_2-manifest.json",
                    label="1986 Chesapeake and Ohio Canal, Washington, D.C., Maryland, West Virginia, official map and guide",
                    navDate="1986-01-01T00:00:00Z")

canvas = manifest.make_canvas_from_iiif(url="https://iiif.io/api/image/3.0/example/reference/43153e2ec7531f14dd1c9b2fc401678a-87691274-1986",
                                        id="https://iiif.io/api/cookbook/recipe/0230-navdate/canvas/p1",
                                        label="1986 Map, recto and verso, with a date of publication",
                                        anno_id="https://iiif.io/api/cookbook/recipe/0230-navdate/annotation/p0001-image",
                                        anno_page_id="https://iiif.io/api/cookbook/recipe/0230-navdate/page/p1/1")

# This is a workaround for an inconsistency in the Cookbook JSON - see https://github.com/IIIF/cookbook-recipes/issues/376
canvas.items[0].items[0].body.service[0].id = "https://iiif.io/api/image/3.0/example/reference/43153e2ec7531f14dd1c9b2fc401678a-87691274-1986/"

print(manifest.json(indent=2))

Example 2 - 1987 Map

from iiif_prezi3 import Manifest, config

config.configs['helpers.auto_fields.AutoLang'].auto_lang = "en"

manifest = Manifest(id="https://iiif.io/api/cookbook/recipe/0230-navdate/navdate_map_1-manifest.json",
                    label="1987 Chesapeake and Ohio Canal, Washington, D.C., Maryland, West Virginia, official map and guide",
                    navDate="1987-01-01T00:00:00Z")
canvas = manifest.make_canvas_from_iiif(url="https://iiif.io/api/image/3.0/example/reference/43153e2ec7531f14dd1c9b2fc401678a-88695674",
                                        id="https://iiif.io/api/cookbook/recipe/0230-navdate/canvas/p1",
                                        label="1987 Map, recto and verso, with a date of publication",
                                        anno_id="https://iiif.io/api/cookbook/recipe/0230-navdate/annotation/p0001-image",
                                        anno_page_id="https://iiif.io/api/cookbook/recipe/0230-navdate/page/p1/1")

# This is a workaround for an inconsistency in the Cookbook JSON - see https://github.com/IIIF/cookbook-recipes/issues/376
canvas.items[0].items[0].body.service[0].id = "https://iiif.io/api/image/3.0/example/reference/43153e2ec7531f14dd1c9b2fc401678a-88695674/"

print(manifest.json(indent=2))

Example 3 - Collection

To show the different possible approaches, here we will build the Collection object manually using the ManifestRef class.

from iiif_prezi3 import Collection, ManifestRef, ResourceItem, config

config.configs['helpers.auto_fields.AutoLang'].auto_lang = "en"

collection = Collection(id="https://iiif.io/api/cookbook/recipe/0230-navdate/navdate-collection.json",
                        label="Chesapeake and Ohio Canal map and guide pamphlets")
thumbnail = ResourceItem(id="https://iiif.io/api/image/3.0/example/reference/43153e2ec7531f14dd1c9b2fc401678a-88695674/full/max/0/default.jpg",
                         type="Image",
                         format="image/jpeg",
                         height=300,
                         width=221)
thumbnail.make_service(id="https://iiif.io/api/image/3.0/example/reference/43153e2ec7531f14dd1c9b2fc401678a-88695674",
                       type="ImageService3",
                       profile="level1")
collection.thumbnail = [thumbnail]

manifest1986 = ManifestRef(id="https://iiif.io/api/cookbook/recipe/0230-navdate/navdate_map_2-manifest.json",
                           type="Manifest",
                           label="1986 Chesapeake and Ohio Canal, Washington, D.C., Maryland, West Virginia, official map and guide",
                           navDate="1986-01-01T00:00:00+00:00")

manifest1987 = ManifestRef(id="https://iiif.io/api/cookbook/recipe/0230-navdate/navdate_map_1-manifest.json",
                           type="Manifest",
                           label="1987 Chesapeake and Ohio Canal, Washington, D.C., Maryland, West Virginia, official map and guide",
                           navDate="1987-01-01T00:00:00+00:00")

collection.add_item(manifest1986)
collection.add_item(manifest1987)

print(collection.json(indent=2))