Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#94: add EO extension JSON schema #240

Merged
merged 6 commits into from
Oct 7, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions extensions/json-schema/stac-eo-extension.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"id": "stac-eo-spec.json#",
"title": "EO Item",
"type": "object",
"description": "STAC Earth Observation (EO) Extension to a STAC Item. See https://github.com/radiantearth/stac-spec/blob/dev/extensions/stac-eo-spec.md",
"additionalProperties": true,
"allOf": [
{
"$ref": "#/definitions/eo"
}
],
"definitions": {
"eo": {
"allOf": [
{
"oneOf": [
{
"$ref": "https://raw.githubusercontent.com/radiantearth/stac-spec/master/json-spec/json-schema/stac-item.json#/definitions/core"
Copy link
Collaborator

@m-mohr m-mohr Sep 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validator (ajv) we are using in this repository doesn't allow referencing schemas by URL, so we couldn't use this in the CI. Can this be changed to a relative URL? Otherwise I'd just remove the inheritance. Don't see a major advantage here. You could just validate against Item and EO extension separately.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use relative references then I think we will need all the JSON schemas to live in the same path, i.e. we able to directly construct the path between the relative references. We can do this but we'd have to change the layout to put all JSON schema in one path (like all in one folder), but then you'd either need to put your custom extension schemas there or everybody who uses your custom schema would need to build the appropriate reference resolver. I really put in the absolute reference to get out of the need for custom reference resolvers.

The advantage I see with this inheritance is that we don't need to know the relationship between the various schemas in order to perform the validation. The idea here is that the schema itself says that this extension is extending these various schemas and adding in the specified components.

For instance you could write a schema that requires the item to be both a EO item and a item with the start/stop time extension, plus some other custom fields... The schema would include these various definitions from the extension's schemas and enforce this without the end validation user needing to know to check these other schemas.

Copy link
Collaborator

@m-mohr m-mohr Sep 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand all your points made here, but it just won't work with the validator we are using (see ajv-validator/ajv-cli#29 ) and therefore we can't use it in CI. We either need to use another validator or remove the dependency to items for now, I think. (But that's nothing that prevents an approval of the PR.)

}
]
},
{
"type": "object",
"properties": {
"properties": {
"type": "object",
"required": [
"eo:gsd",
"eo:platform",
"eo:constellation",
"eo:instrument"
],
"properties": {
"eo:gsd": {
"title": "Ground Sample Distance",
"description": "Ground Sample distance. The nominal distance between pixel centers available, in meters.",
"type": "number"
},
"eo:platform": {
"title": "Platform",
"description": "Unique name of the specific platform the instrument is attached to. For satellites this would be the name of the satellite (e.g., landsat-8, sentinel-2A), whereas for drones this would be a unique name for the drone.",
"type": "string"
},
"eo:constellation": {
"title": "Constellation",
"description": "Name of the group or constellation that the platform belongs to.",
"type": "string"
},
"eo:instrument": {
"title": "Instrument",
"description": "Name of instrument or sensor used (e.g., MODIS, ASTER, OLI, Canon F-1).",
"type": "string"
},
"eo:bands": {
"title": "Bands",
"type": "object",
"description": "This is a dictionary of band information where each key in the dictionary is an identifier for the band (e.g., 'B01', 'B02', 'B1', 'B5', 'QA').",
"properties": {
"common_name": {
"title": "Common Name",
"type": "string",
"description": "The name commonly used to refer to the band to make it easier to search for bands across instruments. See list of accepted common names at https://github.com/radiantearth/stac-spec/blob/dev/extensions/stac-eo-spec.md."
},
"gsd": {
"title": "Ground Sample Distance",
"description": "Ground Sample distance. The nominal distance between pixel centers available, in meters.",
"type": "number"
},
"accuracy": {
"title": "Accuracy",
"description": "The expected error between the measured location and the true location of a pixel, in meters on the ground.",
"type": "number"
},
"center_wavelength": {
"title": "Center Wavelength",
"description": "The center wavelength of the band, in microns.",
"type": "number"
},
"full_width_half_max": {
"title": "Full Width Half Max",
"description": "Full width at half maximum (FWHM). The width of the band, as measured at half the maximum transmission, in microns.",
"type": "number"
}
},
"eo:epsg": {
"title": "EPSG",
"description": "EPSG code of the datasource's projection system.",
"type": "integer"
},
"eo:cloud_cover": {
"title": "Cloud Cover",
"description": "Estimate of cloud cover as a percentage (0-100) of the entire scene. If not available the field should not be provided.",
"type": "integer"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"minimum": 0
"maximum": 100

should be added.

},
"eo:off_nadir": {
"title": "Off Nadir",
"description": "Viewing angle. The angle from the sensor between nadir (straight down) and the scene center. Measured in degrees (0-90).",
"type": "number"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"minimum": 0
"maximum": 90

should be added.

},
"eo:azimuth": {
"title": "Azimuth",
"description": "Viewing azimuth angle. The angle measured from the sub-satellite point (point on the ground below the platform) between the scene center and true north. Measured clockwise from north in degrees (0-360).",
"type": "number"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"minimum": 0
"maximum": 360

should be added.

},
"eo:sun_azimuth": {
"title": "Sun Azimuth",
"description": "Sun azimuth angle. From the scene center point on the ground, this is the angle between truth north and the sun. Measured clockwise in degrees (0-360).",
"type": "number"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"minimum": 0
"maximum": 360

should be added.

},
"eo:sun_elevation": {
"title": "Sun Elevation",
"description": "Sun elevation angle. The angle from the tangent of the scene center point to the sun. Measured from the horizon in degrees (0-90).",
"type": "number"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"minimum": 0
"maximum": 90

should be added.

}
}
}
}
}
}
]
}
}
}