Skip to content

Commit

Permalink
feat: add summaries to historical imagery related extensions (#176)
Browse files Browse the repository at this point in the history
* feat(scanning): add scanning summaries

* feat(camera): add camera summaries

* feat(film): add film summaries

* feat(aerial-photo): add aerial photography summaries

* feat(historical-imagery): add historical imagery summaries

Co-authored-by: Daniel Silk <dsilk@linz.govt.nz>
  • Loading branch information
MDavidson17 and dwsilk authored Nov 24, 2021
1 parent 74eecc6 commit 56e130e
Show file tree
Hide file tree
Showing 10 changed files with 336 additions and 11 deletions.
67 changes: 66 additions & 1 deletion extensions/aerial-photo/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@
"type": "object",
"allOf": [
{
"required": ["type"],
"required": ["type", "summaries"],
"properties": {
"type": {
"const": "Collection"
}
}
},
{
"$ref": "#/definitions/fields"
},
{
"$ref": "#/definitions/stac_extensions"
}
Expand Down Expand Up @@ -90,6 +93,68 @@
"aerial-photo:anomalies": {
"title": "Image anomalies",
"type": "string"
},
"summaries": {
"type": "object",
"required": ["aerial-photo:run", "aerial-photo:sequence_number"],
"properties": {
"aerial-photo:run": {
"type": "array",
"items": {
"type": "string",
"minItems": 1
}
},
"aerial-photo:sequence_number": {
"type": "object",
"required": ["minimum", "maximum"],
"properties": {
"minimum": {
"title": "Lowest sequence number",
"type": "integer"
},
"maximum": {
"title": "Highest sequence number",
"type": "integer"
}
}
},
"aerial-photo:altitude": {
"type": "object",
"required": ["minimum", "maximum"],
"properties": {
"minimum": {
"title": "Lowest altitude",
"type": "integer"
},
"maximum": {
"title": "Highest altitude",
"type": "integer"
}
}
},
"aerial-photo:scale": {
"type": "object",
"required": ["minimum", "maximum"],
"properties": {
"minimum": {
"title": "Minimum scale",
"type": "integer"
},
"maximum": {
"title": "Maximum scale",
"type": "integer"
}
}
},
"aerial-photo:anomalies": {
"type": "array",
"items": {
"type": "string",
"minItems": 1
}
}
}
}
},
"patternProperties": {
Expand Down
35 changes: 35 additions & 0 deletions extensions/aerial-photo/tests/aerial_photo_collection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,39 @@ o.spec('Aerial Photo Extension Collection', () => {
// then
o(valid).equals(true)(JSON.stringify(validate.errors, null, 2));
});
o("Summaries with no 'aerial-photo:run' property should fail validation", async () => {
// given
const example = JSON.parse(await fs.readFile(examplePath));
delete example.summaries['aerial-photo:run'];

// when
let valid = validate(example);

// then
o(valid).equals(false);
o(
validate.errors.some(
(error) =>
error.instancePath === '/summaries' && error.message === "must have required property 'aerial-photo:run'",
),
).equals(true)(JSON.stringify(validate.errors));
});
o("Summaries with no 'aerial-photo:sequence_number' property should fail validation", async () => {
// given
const example = JSON.parse(await fs.readFile(examplePath));
delete example.summaries['aerial-photo:sequence_number'];

// when
let valid = validate(example);

// then
o(valid).equals(false);
o(
validate.errors.some(
(error) =>
error.instancePath === '/summaries' &&
error.message === "must have required property 'aerial-photo:sequence_number'",
),
).equals(true)(JSON.stringify(validate.errors));
});
});
36 changes: 36 additions & 0 deletions extensions/camera/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
}
}
},
{
"$ref": "#/definitions/fields"
},
{
"$ref": "#/definitions/stac_extensions"
}
Expand Down Expand Up @@ -71,6 +74,39 @@
"camera:nominal_focal_length": {
"title": "Nominal Focal Length",
"type": ["integer"]
},
"summaries": {
"type": "object",
"properties": {
"camera:sequence_number": {
"type": "object",
"required": ["minimum", "maximum"],
"properties": {
"minimum": {
"title": "Lowest sequence number",
"type": "integer"
},
"maximum": {
"title": "Highest sequence number",
"type": "integer"
}
}
},
"camera:nominal_focal_length": {
"type": "object",
"required": ["minimum", "maximum"],
"properties": {
"minimum": {
"title": "Lowest nominal focal length",
"type": "integer"
},
"maximum": {
"title": "Highest nominal focal length",
"type": "integer"
}
}
}
}
}
},
"patternProperties": {
Expand Down
2 changes: 1 addition & 1 deletion extensions/film/examples/collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"mission": ["399"],
"film:id": ["464", "465", "466", "470", "476", "486", "577", "579", "580", "728", "731", "732"],
"film:negative_sequence": {
"mimimum": 1,
"minimum": 1,
"maximum": 184
},
"film:physical_condition": ["Film scratched", "NOT 10/03/1949", "NOT 16/04/1947"],
Expand Down
46 changes: 45 additions & 1 deletion extensions/film/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@
"type": "object",
"allOf": [
{
"required": ["type"],
"required": ["type", "summaries"],
"properties": {
"type": {
"const": "Collection"
}
}
},
{
"$ref": "#/definitions/fields"
},
{
"$ref": "#/definitions/stac_extensions"
}
Expand Down Expand Up @@ -86,6 +89,47 @@
"film:physical_size": {
"title": "Physical Size Format",
"type": "string"
},
"summaries": {
"type": "object",
"required": ["film:id", "film:negative_sequence"],
"properties": {
"film:id": {
"type": "array",
"items": {
"type": "string",
"minItems": 1
}
},
"film:negative_sequence": {
"type": "object",
"required": ["minimum", "maximum"],
"properties": {
"minimum": {
"title": "Lowest negative sequence number",
"type": "integer"
},
"maximum": {
"title": "Highest negative sequence number",
"type": "integer"
}
}
},
"film:physical_condition": {
"type": "array",
"items": {
"type": "string",
"minItems": 1
}
},
"film:physical_size": {
"type": "array",
"items": {
"type": "string",
"minItems": 1
}
}
}
}
},
"patternProperties": {
Expand Down
34 changes: 34 additions & 0 deletions extensions/film/tests/film_collection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,38 @@ o.spec('Film Extension Collection', () => {
// then
o(valid).equals(true)(JSON.stringify(validate.errors, null, 2));
});
o("Summaries with no 'film:id' property should fail validation", async () => {
// given
const example = JSON.parse(await fs.readFile(examplePath));
delete example.summaries['film:id'];

// when
let valid = validate(example);

// then
o(valid).equals(false);
o(
validate.errors.some(
(error) => error.instancePath === '/summaries' && error.message === "must have required property 'film:id'",
),
).equals(true)(JSON.stringify(validate.errors));
});
o("Summaries with no 'film:negative_sequence' property should fail validation", async () => {
// given
const example = JSON.parse(await fs.readFile(examplePath));
delete example.summaries['film:negative_sequence'];

// when
let valid = validate(example);

// then
o(valid).equals(false);
o(
validate.errors.some(
(error) =>
error.instancePath === '/summaries' &&
error.message === "must have required property 'film:negative_sequence'",
),
).equals(true)(JSON.stringify(validate.errors));
});
});
7 changes: 2 additions & 5 deletions extensions/historical-imagery/examples/collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@
"minimum": "2018-06-30T12:00:00Z",
"maximum": "2019-12-31T11:00:00Z"
},
"proj:epsg": {
"minimum": 2193,
"maximum": 2193
},
"proj:epsg": [2193],
"aerial-photo:altitude": {
"minimum": 10000,
"maximum": 11000
Expand All @@ -115,7 +112,7 @@
"maximum": 508
},
"film:negative_sequence": {
"mimimum": 1,
"minimum": 1,
"maximum": 184
}
},
Expand Down
39 changes: 36 additions & 3 deletions extensions/historical-imagery/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
"allOf": [
{
"type": "object",
"required": ["type", "title", "providers"],
"required": ["type", "title", "providers", "summaries"],
"properties": {
"type": {
"const": "Collection"
}
}
},
{
"$ref": "#/definitions/fields_collection"
"$ref": "#/definitions/fields"
},
{
"$ref": "#/definitions/stac_extensions"
Expand Down Expand Up @@ -106,7 +106,7 @@
}
}
},
"fields_collection": {
"fields": {
"type": "object",
"$comment": "Remove licensor and producer when validation against linz STAC extension is included.",
"properties": {
Expand Down Expand Up @@ -157,6 +157,39 @@
}
}
]
},
"summaries": {
"required": ["platform", "mission", "proj:epsg"],
"properties": {
"platform": {
"type": "array",
"items": {
"type": "string",
"minItems": 1
}
},
"mission": {
"type": "array",
"items": {
"type": "string",
"minItems": 1
}
},
"instruments": {
"type": "array",
"items": {
"type": "string",
"minItems": 1
}
},
"proj:epsg": {
"type": "array",
"items": {
"type": "integer",
"minItems": 1
}
}
}
}
}
}
Expand Down
Loading

0 comments on commit 56e130e

Please sign in to comment.