Skip to content

Commit

Permalink
Clean-up spec and JSON Schema (#131)
Browse files Browse the repository at this point in the history
* Update JSON Schema and data types #128, 129

* Allow null for crs again and clarify the data types in the table

* Update to latest changes

* Require min length for column names, don't allow additional (invalid) columns

* Update format-specs/geoparquet.md

Co-authored-by: Matthias Mohr <webmaster@mamo-net.de>

Co-authored-by: Tim Schaub <tschaub@users.noreply.github.com>
  • Loading branch information
m-mohr and tschaub committed Dec 5, 2022
1 parent 89036f4 commit 7a7826f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 38 deletions.
24 changes: 12 additions & 12 deletions format-specs/geoparquet.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ All file-level metadata should be included under the "geo" key in the parquet me

| Field Name | Type | Description |
| ------------------ | ------ | -------------------------------------------------------------------- |
| version | string | **REQUIRED** The version of the GeoParquet metadata standard used when writing. |
| primary_column | string | **REQUIRED** The name of the "primary" geometry column. |
| columns | object<key, [Column Metadata](#column-metadata)> | **REQUIRED** Metadata about geometry columns. Each key is the name of a geometry column in the table. |
| version | string | **REQUIRED** The version of the GeoParquet metadata standard used when writing. |
| primary_column | string | **REQUIRED** The name of the "primary" geometry column. |
| columns | object\<string, [Column Metadata](#column-metadata)> | **REQUIRED** Metadata about geometry columns. Each key is the name of a geometry column in the table. |

At this level, additional implementation-specific fields (e.g. library name) are allowed, and thus readers should be robust in ignoring those.

Expand All @@ -58,15 +58,15 @@ Version of the GeoParquet spec used, currently 0.4.0

Each geometry column in the dataset must be included in the columns field above with the following content, keyed by the column name:

| Field Name | Type | Description |
| --- | --- | --- |
| encoding | string | **REQUIRED** Name of the geometry encoding format. Currently only `"WKB"` is supported. |
| geometry_types | \[string] | **REQUIRED** The geometry types of all geometries, or an empty array if they are not known. |
| crs | object | **OPTIONAL** [PROJJSON](https://proj.org/specifications/projjson.html) object representing the Coordinate Reference System (CRS) of the geometry. If the crs field is not included then the data in this column must be stored in longitude, latitude based on the WGS84 datum, and CRS-aware implementations should assume a default value of [OGC:CRS84](https://www.opengis.net/def/crs/OGC/1.3/CRS84). |
| orientation | string | **OPTIONAL** Winding order of exterior ring of polygons. If present must be `"counterclockwise"`; interior rings are wound in opposite order. If absent, no assertions are made regarding the winding order. |
| edges | string | **OPTIONAL** Name of the coordinate system for the edges. Must be one of `"planar"` or `"spherical"`. The default value is `"planar"`. |
| bbox | \[number] | **OPTIONAL** Bounding Box of the geometries in the file, formatted according to [RFC 7946, section 5](https://tools.ietf.org/html/rfc7946#section-5). |
| epoch | number | **OPTIONAL** Coordinate epoch in case of a dynamic CRS, expressed as a decimal year. |
| Field Name | Type | Description |
| -------------- | ------------ | ----------- |
| encoding | string | **REQUIRED** Name of the geometry encoding format. Currently only `"WKB"` is supported. |
| geometry_types | \[string] | **REQUIRED** The geometry types of all geometries, or an empty array if they are not known. |
| crs | object\|null | **OPTIONAL** [PROJJSON](https://proj.org/specifications/projjson.html) object representing the Coordinate Reference System (CRS) of the geometry. If the crs field is not included then the data in this column must be stored in longitude, latitude based on the WGS84 datum, and CRS-aware implementations should assume a default value of [OGC:CRS84](https://www.opengis.net/def/crs/OGC/1.3/CRS84). A value of `null` indicates that the CRS is undefined or unknown. |
| orientation | string | **OPTIONAL** Winding order of exterior ring of polygons. If present must be `"counterclockwise"`; interior rings are wound in opposite order. If absent, no assertions are made regarding the winding order. |
| edges | string | **OPTIONAL** Name of the coordinate system for the edges. Must be one of `"planar"` or `"spherical"`. The default value is `"planar"`. |
| bbox | \[number] | **OPTIONAL** Bounding Box of the geometries in the file, formatted according to [RFC 7946, section 5](https://tools.ietf.org/html/rfc7946#section-5). |
| epoch | number | **OPTIONAL** Coordinate epoch in case of a dynamic CRS, expressed as a decimal year. |

#### crs

Expand Down
41 changes: 15 additions & 26 deletions format-specs/schema.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "GeoParquet",
"type": "object",
"description": "Parquet metadata included in the geo field.",
"type": "object",
"required": ["version", "primary_column", "columns"],
"properties": {
"version": {
"type": "string",
"const": "0.5.0-dev",
"description": "The version of the GeoParquet metadata standard used when writing."
"const": "0.5.0-dev"
},
"primary_column": {
"type": "string",
"minLength": 1,
"description": "The name of the 'primary' geometry column."
"minLength": 1
},
"columns": {
"type": "object",
"description": "Metadata about geometry columns, with each key is the name of a geometry column in the table.",
"patternProperties": {
".*": {
".+": {
"type": "object",
"required": ["encoding", "geometry_types"],
"properties": {
"encoding": {
"type": "string",
"enum": ["WKB"],
"description": "Name of the geometry encoding format. Currently only 'WKB' is supported."
"const": "WKB"
},
"geometry_types": {
"description": "The geometry types of all geometries, or an empty array if they are not known.",
"type": "array",
"uniqueItems": true,
"items": {
Expand All @@ -43,22 +40,18 @@
{
"type": "null"
}
],
"description": "JSON object representing the Coordinate Reference System (CRS) of the geometry. If the crs field is not included then the data in this column must be stored in longitude, latitude based on the WGS84 datum, and CRS-aware implementations should assume a default value of OGC:CRS84."
]
},
"edges": {
"type": "string",
"enum": ["planar", "spherical"],
"description": "Name of the coordinate system for the edges. Must be one of 'planar' or 'spherical'. The default value is 'planar'."
"enum": ["planar", "spherical"]
},
"orientation": {
"type": "string",
"enum": ["counterclockwise"],
"description": "Winding order of exterior ring of polygons; interior rings are wound in opposite order. If absent, no assertions are made regarding the winding order."
"const": "counterclockwise"
},
"bbox": {
"type": "array",
"description": "Bounding Box of the geometries in the file, formatted according to RFC 7946, section 5.",
"items": {
"type": "number"
},
Expand All @@ -76,16 +69,12 @@
]
},
"epoch": {
"type": "number",
"description": "Coordinate epoch in case of a dynamic CRS, expressed as a decimal year."
"type": "number"
}
},
"additionalProperties": true,
"required": ["encoding", "geometry_types"]
}
}
}
},
"additionalProperties": false
}
},
"additionalProperties": true,
"required": ["version", "primary_column", "columns"]
}
}

0 comments on commit 7a7826f

Please sign in to comment.