翻译者:ginkgo

原文链接:https://iiif.io/api/cookbook/recipe/0139-geolocate-canvas-fragment/

译文:

许多现实世界的资源受益于地理数据,其中许多已经在 IIIF 数字馆藏中得到体现:新旧地图、旅游期刊、报纸、手稿、诗歌和日记等等。他们还只是具有地理特征的文化遗产文物的一个子集。这些特征为资料带来了人文背景,并为发现不同资源之间的联系提供了一个可识别的、舒适的环境。

用例

一张画布(Canvas)上有一个包含地图的兴趣区域。您希望将此地图与地理坐标相关联,以便在LeafletOpenLayers等Web地图客户端中使用。这可能意味着简单地在Web地图上显示非交互式形状,但出于实用目的,通常更多地是显示其他与形状相关的资源数据。下面的示例显示了单击形状时出现的弹出窗口。弹出窗口包括目标地图以及来自资源的其他元数据。
在Web地图客户端中利用画布片段展示地理区域 - 图1 在Web地图客户端中利用画布片段展示地理区域 - 图2

实现说明

除了IIIF展示API3.0上下文之外,还包括第三方GeoJSON-LD上下文。GeoJSON-LD上下文为注释(Annotation)主体提供词汇术语,因为IIIF展示API3.0上下文没有描述这些术语。当有多个上下文时,@context属性可以是作为集合处理的数组。一般而言,顺序对于集合来说无关紧要。但是,当在这些数组中使用IIIF上下文时,它必须是集合中的最后一项。

GeoJSON中的properties对象是通用的,几乎可以是任何东西。它用于传递元数据和地理坐标。这对必须分辨所使用的数据的客户端和解析器是有帮助的。例如,如果目标资源有一个label属性而properties对象有一个label属性,则使用接口必须选择优先呈现的对象。在用例部分的图像中,“标签”使用 GeoJSON中的properties对象的label属性(第 80-83 行)而不是来自注释(Annotation)或画布(Canvas)的label属性。这是因为 Web 地图客户端旨在查找 GeoJSON中的properties对象的元数据以进行显示。

请注意,除了多边形(Polygon),几何图形(geometry)还有其他类型取值。

限制

严格遵循关联数据(Linked Data)实践的应用程序会发现嵌套的 GeoJSON 坐标数组与 JSON-LD 1.0 的处理模型不兼容。JSON-LD 1.1 处理模型没有此限制。如果您计划将 JSON-LD 序列化为其他语义数据格式或标记语言(如 RDF),请注意这一点。

示例

清单(Manifest)中有一个带有图像(Image)的画布(Canvas) ,画布的尺寸与图像相同。画布有一个注释页(Annotation Page),其中一个注释以使用#xywh Fragment Selector 语法进行地图描述的兴趣区域为目标。注释body是 GeoJSON-LD,它得到了许多开源地图系统的支持。客户端可以解析画布中的注释并将注释body传递到Web地图中,从而在世界地图上呈现几何形状。通常,来自资源的数据(例如图像 URL、标签或描述)通过GeoJSON中的properties与这些形状相关联。由于使用的图像是遵循IIIF图像API3.0规范的IIIF配件(Fixture) ,您可以通过提供#xywh 选择器中用于图像 URL 的值来查看目标片段。

JSON-LD

  1. {
  2. "@context": [
  3. "http://geojson.org/geojson-ld/geojson-context.jsonld",
  4. "http://iiif.io/api/presentation/3/context.json"
  5. ],
  6. "id": "https://iiif.io/api/cookbook/recipe/0139-geolocate-canvas-fragment/manifest.json",
  7. "type": "Manifest",
  8. "label": {
  9. "en": [
  10. "Recipe Manifest for #139"
  11. ]
  12. },
  13. "summary": {
  14. "en": [
  15. "A IIIF Presentation API 3.0 Manifest containing a GeoJSON-LD Web Annotation which targets a Canvas fragment."
  16. ]
  17. },
  18. "items": [
  19. {
  20. "id": "https://iiif.io/api/cookbook/recipe/0139-geolocate-canvas-fragment/canvas.json",
  21. "type": "Canvas",
  22. "label": {
  23. "en": [
  24. "Chesapeake and Ohio Canal Pamphlet"
  25. ]
  26. },
  27. "width": 5212,
  28. "height": 7072,
  29. "items": [
  30. {
  31. "id": "https://iiif.io/api/cookbook/recipe/0139-geolocate-canvas-fragment/contentPage.json",
  32. "type": "AnnotationPage",
  33. "items": [
  34. {
  35. "id": "https://iiif.io/api/cookbook/recipe/0139-geolocate-canvas-fragment/content.json",
  36. "type": "Annotation",
  37. "motivation": "painting",
  38. "label": {
  39. "en": [
  40. "Pamphlet Cover"
  41. ]
  42. },
  43. "body": {
  44. "id": "https://iiif.io/api/image/3.0/example/reference/43153e2ec7531f14dd1c9b2fc401678a-88695674/full/max/0/default.jpg",
  45. "type": "Image",
  46. "format": "image/jpeg",
  47. "service": [
  48. {
  49. "id": "https://iiif.io/api/image/3.0/example/reference/43153e2ec7531f14dd1c9b2fc401678a-88695674",
  50. "type": "ImageService3",
  51. "profile": "level1"
  52. }
  53. ],
  54. "width": 5212,
  55. "height": 7072
  56. },
  57. "target": "https://iiif.io/api/cookbook/recipe/0139-geolocate-canvas-fragment/canvas.json"
  58. }
  59. ]
  60. }
  61. ],
  62. "annotations": [
  63. {
  64. "id": "https://iiif.io/api/cookbook/recipe/0139-geolocate-canvas-fragment/supplementingPage.json",
  65. "type": "AnnotationPage",
  66. "items": [
  67. {
  68. "id": "https://iiif.io/api/cookbook/recipe/0139-geolocate-canvas-fragment/geoAnno.json",
  69. "type": "Annotation",
  70. "motivation": "tagging",
  71. "label": {
  72. "en": [
  73. "Annotation containing GeoJSON-LD coordinates that place the map depiction onto a Leaflet web map."
  74. ]
  75. },
  76. "body": {
  77. "id": "https://iiif.io/api/cookbook/recipe/0139-geolocate-canvas-fragment/geo.json",
  78. "type": "Feature",
  79. "properties": {
  80. "label": {
  81. "en": [
  82. "Targeted Map from Chesapeake and Ohio Canal Pamphlet"
  83. ]
  84. }
  85. },
  86. "geometry": {
  87. "type": "Polygon",
  88. "coordinates": [
  89. [
  90. [
  91. -77.097847,
  92. 38.901359
  93. ],
  94. [
  95. -77.02694,
  96. 38.901359
  97. ],
  98. [
  99. -77.02694,
  100. 39.03404
  101. ],
  102. [
  103. -77.097847,
  104. 39.03404
  105. ]
  106. ]
  107. ]
  108. }
  109. },
  110. "target": "https://iiif.io/api/cookbook/recipe/0139-geolocate-canvas-fragment/canvas.json#xywh=920,3600,1510,3000"
  111. }
  112. ]
  113. }
  114. ]
  115. }
  116. ]
  117. }

相关专题

  • [片段选择器][0020]
  • [标签注释][0021]