Skip to content

Commit

Permalink
Array of geometry types
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaub committed Nov 7, 2022
1 parent 134ebef commit 9f94199
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 35 deletions.
Binary file modified examples/example.parquet
Binary file not shown.
4 changes: 2 additions & 2 deletions examples/example.py
Expand Up @@ -23,12 +23,12 @@


metadata = {
"version": "0.4.0",
"version": "0.5.0-dev",
"primary_column": "geometry",
"columns": {
"geometry": {
"encoding": "WKB",
"geometry_type": ["Polygon", "MultiPolygon"],
"geometry_types": ["Polygon", "MultiPolygon"],
"crs": json.loads(df.crs.to_json()),
"edges": "planar",
"bbox": [round(x, 4) for x in df.total_bounds],
Expand Down
6 changes: 3 additions & 3 deletions examples/example_metadata.json
Expand Up @@ -9,7 +9,7 @@
83.6451
],
"crs": {
"$schema": "https://proj.org/schemas/v0.4/projjson.schema.json",
"$schema": "https://proj.org/schemas/v0.5/projjson.schema.json",
"area": "World.",
"bbox": {
"east_longitude": 180,
Expand Down Expand Up @@ -108,13 +108,13 @@
},
"edges": "planar",
"encoding": "WKB",
"geometry_type": [
"geometry_types": [
"Polygon",
"MultiPolygon"
]
}
},
"primary_column": "geometry",
"version": "0.4.0"
"version": "0.5.0-dev"
}
}
14 changes: 6 additions & 8 deletions format-specs/geoparquet.md
Expand Up @@ -53,7 +53,7 @@ Each geometry column in the dataset must be included in the columns field above
| Field Name | Type | Description |
| --- | --- | --- |
| encoding | string | **REQUIRED** Name of the geometry encoding format. Currently only 'WKB' is supported. |
| geometry_type | string or \[string] | **REQUIRED** The geometry type(s) of all geometries, or 'Unknown' if they are not known. |
| geometry_types | \[string] | **REQUIRED** The geometry types of all geometries, or an empty array if they are not known. |
| crs | JSON object | **OPTIONAL** [PROJJSON](https://proj.org/specifications/projjson.html) 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](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'. |
Expand Down Expand Up @@ -110,26 +110,24 @@ The axis order of the coordinates in WKB stored in a geoparquet follows the de f
(x, y) where x is easting or longitude and y is northing or latitude. This ordering explicitly overrides the axis order as specified in the CRS.
This follows the precedent of [GeoPackage](https://geopackage.org), see the [note in their spec](https://www.geopackage.org/spec130/#gpb_spec).

#### geometry_type
#### geometry_types

This field captures the geometry type(s) of the geometries in the
This field captures the geometry types of the geometries in the
column, when known. Accepted geometry types are: "Point", "LineString",
"Polygon", "MultiPoint", "MultiLineString", "MultiPolygon",
"GeometryCollection".

In addition, the following rules are used:

- In case of 3D geometries, a " Z" suffix gets added (e.g. "Point Z").
- The value can be a single string or an array of strings in case multiple
geometry types are present (e.g. ["Polygon", "MultiPolygon"]).
- Additionally the value "Unknown" is accepted to explicitly signal that the
geometry type is not known.
- A list of values indicates that multiple geometry types are present (e.g. ["Polygon", "MultiPolygon"]).
- An empty array explicitly signals that the geometry types are not known.

It is expected that this field is strictly correct. For
example, if having both polygons and multipolygons, it is not sufficient to
specify "MultiPolygon", but it is expected to specify
["Polygon", "MultiPolygon"]. Or if having 3D points, it is not sufficient to
specify "Point", but it is expected to list "Point Z".
specify ["Point"], but it is expected to list ["Point Z"].

#### orientation

Expand Down
31 changes: 9 additions & 22 deletions format-specs/schema.json
Expand Up @@ -6,7 +6,7 @@
"properties": {
"version": {
"type": "string",
"const": "0.4.0",
"const": "0.5.0-dev",
"description": "The version of the geoparquet metadata standard used when writing."
},
"primary_column": {
Expand All @@ -25,20 +25,13 @@
"enum": ["WKB"],
"description": "Name of the geometry encoding format. Currently only 'WKB' is supported."
},
"geometry_type": {
"oneOf": [
{
"$ref": "#/$defs/geometry_type"
},
{
"type": "array",
"items": {
"$ref": "#/$defs/geometry_type"
},
"uniqueItems": true
}
],
"description": "The geometry type(s) of all geometries, or 'Unknown' if they are not known."
"geometry_types": {
"description": "The geometry types of all geometries, or an empty array if they are not known.",
"type": "array",
"items": {
"type": "string",
"pattern": "^(GeometryCollection|(Multi)?(Point|LineString|Polygon))( Z)?$"
}
},
"crs": {
"oneOf": [
Expand Down Expand Up @@ -95,11 +88,5 @@
}
},
"additionalProperties": true,
"required": ["version", "primary_column", "columns"],
"$defs": {
"geometry_type": {
"type": "string",
"enum": ["Point", "LineString", "Polygon", "MultiPoint", "MultiLineString", "MultiPolygon", "GeometryCollection", "Unknown"]
}
}
"required": ["version", "primary_column", "columns"]
}

0 comments on commit 9f94199

Please sign in to comment.