-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #181 from iiif-prezi/recipe_0261
Add recipe 0261
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
24
docs/recipes/scripts/0261-non-rectangular-commenting-method1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |