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

adding JSON schema for pointcloud extension #861

Merged
merged 4 commits into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]

### Added
- JSON-schema file in the Point Cloud extension.

### Changes

Expand Down
11 changes: 5 additions & 6 deletions extensions/pointcloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ come from either active or passive sensors, and data is frequently acquired usin
tools such as LiDAR or coincidence-matched imagery.

- [Example](examples/example-autzen.json)
- JSON Schema is missing. PRs are welcome.
- [JSON Schema](json-schema/schema.json)

## Item Fields

Expand All @@ -34,21 +34,20 @@ the point cloud, their types, and their sizes (in full bytes).
| ---------- | ------- | -------------------------- |
| name | string | **REQUIRED.** The name of the dimension. |
| size | integer | **REQUIRED.** The size of the dimension in bytes. Whole bytes only are supported. |
| type | string | **REQUIRED.** Dimension type. Valid values include `floating`, `unsigned`, and `signed` |
| type | string | **REQUIRED.** Dimension type. Valid values are `floating`, `unsigned`, and `signed` |

### Stats Object

A sequential array of items mapping to `pc:schemas` defines per-channel statistics. All fields
are optional.
A sequential array of items mapping to `pc:schemas` defines per-channel statistics. The channel name is required and at least one statistic.

| Field Name | Type | Description |
| ---------- | ------- | ----------- |
| name | string | **REQUIRED.** The name of the channel. |
| position | integer | Position of the channel in the schema. |
| average | number | The average of the channel. |
| count | integer | The number of elements in the channel. |
| maximum | number | The maximum value of the channel. |
| minimum | number | The minimum value of the channel. |
| name | string | The name of the channel. |
| position | integer | Position of the channel in the schema. |
| stddev | number | The standard deviation of the channel. |
| variance | number | The variance of the channel. |

Expand Down
130 changes: 130 additions & 0 deletions extensions/pointcloud/json-schema/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.stacspec.org/dev/extensions/pointcloud/json-schema/schema.json#",
"title": "Point Cloud Extension",
"description": "STAC Point Cloud Extension to a STAC Item",
"allOf": [
{
"$ref": "../../../item-spec/json-schema/item.json"
},
{
"$ref": "#/definitions/pointcloud"
}
],
"definitions": {
"pointcloud": {
"type": "object",
"required": [
"stac_extensions",
"properties"
],
"properties": {
"stac_extensions": {
"type": "array",
"contains": {
"enum": [
"pointcloud",
"https://schemas.stacspec.org/dev/extensions/pointcloud/json-schema/schema.json"
]
}
},
"properties": {
"type": "object",
"required": [
"pc:count",
"pc:type",
"pc:encoding",
"pc:schemas"
],
"properties": {
"pc:count": {
"type": "integer",
"minimum": 0
},
"pc:type": {
"type": "string"
},
"pc:encoding": {
"type": "string"
},
"pc:schemas": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/definitions/schema"
}
},
"pc:density": {
"type": "number",
"minimum": 0
},
"pc:statistics": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/definitions/stats"
}
}
}
}
}
},
"schema": {
"type": "object",
"required": [
"name",
"size",
"type"
],
"properties": {
"name": {
"type": "string"
},
"size": {
"type": "integer"
},
"type": {
"type": "string",
"enum": [
"floating",
"unsigned",
"signed"
]
}
}
},
"stats": {
"type": "object",
"minProperties": 2,
"required": [
"name",
],
"properties": {
"name": {
"type": "string"
},
"position": {
"type": "integer"
},
"average": {
"type": "number"
},
"count": {
"type": "integer"
},
"maximum": {
"type": "number"
},
"minimum": {
"type": "number"
},
"stddev": {
"type": "number"
},
"variance": {
"type": "number"
}
}
}
}
}