Skip to content

Commit 839821f

Browse files
authored
feat: require additional fields for historical imagery (require linz extension) (#199)
* feat: require additional fields for historical imagery * fix: linting * fix: added git tag example to readme * fix: fixed typo
1 parent 2e591d6 commit 839821f

File tree

12 files changed

+156
-8
lines changed

12 files changed

+156
-8
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ Verify changes by running `yarn lint && yarn test` before committing.
4444
To create a release:
4545

4646
1. Run `yarn version --new-version <patch|minor|major>` which will create a change log commit and version tag.
47-
2. Run `git push --atomic origin master TAG` which will trigger a GitHub release job. This will publish the new version to the "gh-pages" branch.
47+
2. Run `git push --atomic origin master TAG` (e.g. `git push --atomic origin master v0.0.14`) which will trigger a GitHub release job.
48+
This will publish the new version to the "gh-pages" branch.
4849

4950
## Adding a new extension
5051

extensions/aerial-photo/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"type": "object",
5959
"allOf": [
6060
{
61-
"required": ["type", "summaries"]
61+
"required": ["type"]
6262
},
6363
{
6464
"$ref": "#/definitions/fields"

extensions/aerial-photo/tests/aerial_photo_collection.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ o.spec('Aerial Photo Extension Collection', () => {
3030
o(valid).equals(true)(JSON.stringify(validate.errors, null, 2));
3131
});
3232

33+
o('Missing summaries section should pass validation', async () => {
34+
// given
35+
const example = JSON.parse(await fs.readFile(examplePath));
36+
delete example.summaries;
37+
38+
// when
39+
let valid = validate(example);
40+
41+
// then
42+
o(valid).equals(true)(JSON.stringify(validate.errors, null, 2));
43+
});
44+
3345
o("Summaries with no 'aerial-photo:run' property should fail validation", async () => {
3446
// given
3547
const example = JSON.parse(await fs.readFile(examplePath));

extensions/camera/tests/camera_collection.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,16 @@ o.spec('Camera Extension Collection', () => {
2929
// then
3030
o(valid).equals(true)(JSON.stringify(validate.errors, null, 2));
3131
});
32+
33+
o('Missing summaries section should pass validation', async () => {
34+
// given
35+
const example = JSON.parse(await fs.readFile(examplePath));
36+
delete example.summaries;
37+
38+
// when
39+
let valid = validate(example);
40+
41+
// then
42+
o(valid).equals(true)(JSON.stringify(validate.errors, null, 2));
43+
});
3244
});

extensions/film/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"type": "object",
5959
"allOf": [
6060
{
61-
"required": ["type", "summaries"]
61+
"required": ["type"]
6262
},
6363
{
6464
"$ref": "#/definitions/fields"

extensions/film/tests/film_collection.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ o.spec('Film Extension Collection', () => {
3030
o(valid).equals(true)(JSON.stringify(validate.errors, null, 2));
3131
});
3232

33+
o('Missing summaries section should pass validation', async () => {
34+
// given
35+
const example = JSON.parse(await fs.readFile(examplePath));
36+
delete example.summaries;
37+
38+
// when
39+
let valid = validate(example);
40+
41+
// then
42+
o(valid).equals(true)(JSON.stringify(validate.errors, null, 2));
43+
});
44+
3345
o("Summaries with no 'film:id' property should fail validation", async () => {
3446
// given
3547
const example = JSON.parse(await fs.readFile(examplePath));

extensions/historical-imagery/examples/collection.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
"stac_version": "1.0.0",
44
"stac_extensions": [
55
"https://stac.linz.govt.nz/_STAC_VERSION_/historical-imagery/schema.json",
6+
"https://stac.linz.govt.nz/_STAC_VERSION_/linz/schema.json",
7+
"https://stac.linz.govt.nz/_STAC_VERSION_/quality/schema.json",
68
"https://stac-extensions.github.io/eo/v1.0.0/schema.json",
9+
"https://stac-extensions.github.io/processing/v1.0.0/schema.json",
710
"https://stac-extensions.github.io/projection/v1.0.0/schema.json",
811
"https://stac-extensions.github.io/file/v2.0.0/schema.json",
12+
"https://stac-extensions.github.io/version/v1.0.0/schema.json",
913
"https://stac.linz.govt.nz/_STAC_VERSION_/aerial-photo/schema.json",
1014
"https://stac.linz.govt.nz/_STAC_VERSION_/camera/schema.json",
1115
"https://stac.linz.govt.nz/_STAC_VERSION_/film/schema.json",
@@ -23,6 +27,32 @@
2327
"interval": [["1947-03-28T12:00:00Z", "1952-04-22T12:00:00Z"]]
2428
}
2529
},
30+
"linz:security_classification": "unclassified",
31+
"linz:lifecycle": "completed",
32+
"linz:history": "LINZ and its predecessors, Lands & Survey and Department of Survey and Land Information (DOSLI), commissioned aerial photography for the Crown between 1936 and 2008.\nOne of the predominant uses of the aerial photography at the time was the photogrammetric mapping of New Zealand, initially at 1inch to 1mile followed by the NZMS 260 and Topo50 map series at 1:50,000.\nThese photographs were scanned through the Crown Aerial Film Archive scanning project.",
33+
"linz:providers": [
34+
{
35+
"name": "Toitū Te Whenua LINZ",
36+
"description": "The New Zealand Government's lead agency for location and property information, Crown land and managing overseas investment.",
37+
"roles": ["custodian"],
38+
"url": "https://www.linz.govt.nz/about-linz/what-were-doing/projects/crown-aerial-film-archive-historical-imagery-scanning-project"
39+
},
40+
{
41+
"name": "Manager Partnership Programmes",
42+
"roles": ["manager"]
43+
}
44+
],
45+
"linz:geospatial_type": "black and white image",
46+
"linz:asset_summaries": {
47+
"created": {
48+
"minimum": "1999-01-01T00:00:00Z",
49+
"maximum": "2021-12-09T00:04:09Z"
50+
},
51+
"updated": {
52+
"minimum": "1999-01-02T00:00:00Z",
53+
"maximum": "2021-12-09T00:04:09Z"
54+
}
55+
},
2656
"providers": [
2757
{
2858
"name": "NZ Aerial Mapping",
@@ -36,6 +66,10 @@
3666
"url": "https://www.linz.govt.nz/about-linz/what-were-doing/projects/crown-aerial-film-archive-historical-imagery-scanning-project"
3767
}
3868
],
69+
"processing:software": {
70+
"Topo Processor": "0.1.0"
71+
},
72+
"version": "1",
3973
"summaries": {
4074
"platform": ["Fixed-wing Aircraft"],
4175
"instruments": ["EAGLE IV"],

extensions/historical-imagery/examples/item.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
{
2+
"type": "Feature",
23
"stac_version": "1.0.0",
34
"stac_extensions": [
45
"https://stac.linz.govt.nz/_STAC_VERSION_/historical-imagery/schema.json",
6+
"https://stac.linz.govt.nz/_STAC_VERSION_/linz/schema.json",
57
"https://stac-extensions.github.io/eo/v1.0.0/schema.json",
8+
"https://stac-extensions.github.io/processing/v1.0.0/schema.json",
69
"https://stac-extensions.github.io/projection/v1.0.0/schema.json",
710
"https://stac-extensions.github.io/file/v2.0.0/schema.json",
11+
"https://stac-extensions.github.io/version/v1.0.0/schema.json",
812
"https://stac.linz.govt.nz/_STAC_VERSION_/aerial-photo/schema.json",
913
"https://stac.linz.govt.nz/_STAC_VERSION_/camera/schema.json",
1014
"https://stac.linz.govt.nz/_STAC_VERSION_/film/schema.json",
1115
"https://stac.linz.govt.nz/_STAC_VERSION_/scanning/schema.json"
1216
],
13-
"type": "Feature",
1417
"id": "215354",
1518
"bbox": [170.54524, -45.80237, 170.56431, -45.81345],
1619
"geometry": {
@@ -44,7 +47,11 @@
4447
"film:physical_condition": "Film scratched",
4548
"film:physical_size": "18cm x 23cm",
4649
"scan:is_original": true,
47-
"scan:scanned": "2018-09-30T11:00:00Z"
50+
"scan:scanned": "2018-09-30T11:00:00Z",
51+
"processing:software": {
52+
"Topo Processor": "0.1.0"
53+
},
54+
"version": "1"
4855
},
4956
"links": [
5057
{
@@ -68,7 +75,9 @@
6875
"name": "gray",
6976
"common_name": "pan"
7077
}
71-
]
78+
],
79+
"created": "2021-12-09T00:04:09Z",
80+
"updated": "2021-12-09T00:04:09Z"
7281
}
7382
},
7483
"collection": "01FJ0SE46TT5TGBHBVX64TMEPA"

extensions/historical-imagery/schema.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"properties": {
3030
"type": "object",
3131
"$comment": "Require fields here for Item Properties.",
32-
"required": ["platform", "mission"]
32+
"required": ["platform", "mission", "processing:software"]
3333
},
3434
"assets": {
3535
"type": "object",
@@ -57,7 +57,7 @@
5757
"allOf": [
5858
{
5959
"type": "object",
60-
"required": ["type", "title", "providers", "summaries"]
60+
"required": ["type", "title", "providers", "summaries", "processing:software"]
6161
}
6262
]
6363
},
@@ -78,6 +78,11 @@
7878
"const": "https://stac.linz.govt.nz/_STAC_VERSION_/historical-imagery/schema.json"
7979
}
8080
},
81+
{
82+
"contains": {
83+
"const": "https://stac.linz.govt.nz/_STAC_VERSION_/linz/schema.json"
84+
}
85+
},
8186
{
8287
"contains": {
8388
"const": "https://stac-extensions.github.io/eo/v1.0.0/schema.json"

extensions/historical-imagery/tests/historical-imagery_collection.test.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,23 @@ o.spec('Historical Imagery Extension Collection', () => {
7979
);
8080
});
8181

82+
o("Example with missing 'processing:software' property should fail validation", async () => {
83+
// given
84+
const example = JSON.parse(await fs.readFile(examplePath));
85+
delete example['processing:software'];
86+
87+
// when
88+
let valid = validate(example);
89+
90+
// then
91+
o(valid).equals(false);
92+
o(
93+
validate.errors.some(
94+
(error) => error.instancePath === '' && error.message === "must have required property 'processing:software'",
95+
),
96+
).equals(true)(JSON.stringify(validate.errors));
97+
});
98+
8299
o("Example without 'providers' should fail validation", async () => {
83100
// given
84101
const example = JSON.parse(await fs.readFile(examplePath));
@@ -227,4 +244,21 @@ o.spec('Historical Imagery Extension Collection', () => {
227244
// then
228245
o(valid).equals(true);
229246
});
247+
248+
o("Example with no 'summaries' should fail validation", async () => {
249+
// given
250+
const example = JSON.parse(await fs.readFile(examplePath));
251+
delete example.summaries;
252+
253+
// when
254+
let valid = validate(example);
255+
256+
// then
257+
o(valid).equals(false);
258+
o(
259+
validate.errors.some(
260+
(error) => error.instancePath === '' && error.message === "must have required property 'summaries'",
261+
),
262+
).equals(true)(JSON.stringify(validate.errors));
263+
});
230264
});

0 commit comments

Comments
 (0)