Skip to content

Commit

Permalink
Add recipe 0261
Browse files Browse the repository at this point in the history
  • Loading branch information
digitaldogsbody committed Jun 1, 2023
1 parent c7227d6 commit f222a84
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/recipes/0261-non-rectangular-commenting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Annotation with a Non-Rectangular Polygon
| | **Cookbook URLs** |
|--------------|-------------------|
| **Recipe:** | [https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/](https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/) |
| **JSON-LD:** | [https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/manifest.json](https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/manifest.json) |

### Method 1 -
```python
--8<-- "docs/recipes/scripts/0261-non-rectangular-commenting-method1.py"
```
24 changes: 24 additions & 0 deletions docs/recipes/scripts/0261-non-rectangular-commenting-method1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from iiif_prezi3 import Manifest, config

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

manifest = Manifest(id="https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/manifest.json", label="Picture of Göttingen taken during the 2019 IIIF Conference")
canvas = manifest.make_canvas_from_iiif(url="https://iiif.io/api/image/3.0/example/reference/918ecd18c2592080851777620de9bcb5-gottingen",
id="https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/canvas/p1",
anno_id="https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/annotation/p0001-image",
anno_page_id="https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/page/p1/1")
anno = canvas.make_annotation(id="https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/annotation/p0002-svg",
motivation="tagging",
body={"type": "TextualBody",
"language": "de",
"format": "text/plain",
"value": "Gänseliesel-Brunnen"},
target={"type": "SpecificResource",
"source": canvas.id,
"selector": {"type": "SvgSelector",
"value": "<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'><g><path d='M270.000000,1900.000000 L1530.000000,1900.000000 L1530.000000,1610.000000 L1315.000000,1300.000000 L1200.000000,986.000000 L904.000000,661.000000 L600.000000,986.000000 L500.000000,1300.000000 L270,1630 L270.000000,1900.000000' /></g></svg>"
}
},
anno_page_id="https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/page/p2/1")

print(manifest.json(indent=2))

0 comments on commit f222a84

Please sign in to comment.