Skip to content

Commit aba6af3

Browse files
authored
fix/projjson clarifications (#44)
* add required version field * add clarifying text and update schemas * fix type annotations and prose
1 parent 055f090 commit aba6af3

2 files changed

Lines changed: 32 additions & 17 deletions

File tree

attributes/geo/proj/README.md

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ The `proj` key under the `geo` dictionary can be added to Zarr arrays or groups
4949

5050
### Field Details
5151

52-
Additional properties are allowed.
52+
Additional properties are allowed.
5353

5454
#### geo -> proj.version
5555

@@ -63,7 +63,7 @@ Projection metadata version
6363

6464
Authority:code identifier (e.g., EPSG:4326)
6565

66-
* **Type**: `["string", "null"]`
66+
* **Type**: `string | null`
6767
* **Required**: No
6868
* **Pattern**: `^[A-Z]+:[0-9]+$`
6969

@@ -79,52 +79,58 @@ clients are likely to support are listed in the following table.
7979
| Open Geospatial Consortium (OGC) | <http://www.opengis.net/def/crs/OGC> |
8080
| ESRI | <https://spatialreference.org/ref/esri/> |
8181

82-
The `proj.code` field SHOULD be set to `null` in the following cases:
82+
The `proj.code` field SHOULD be set to `null` or omitted in the following cases:
8383

8484
- The data does not have a CRS, such as in the case of non-rectified imagery with Ground Control Points.
8585
- A CRS exists, but there is no valid EPSG code for it. In this case, the CRS should be provided in `proj.wkt2` and/or `proj.projjson`.
8686
Clients can prefer to take either, although there may be discrepancies in how each might be interpreted.
8787

88+
The `proj.code` field MUST NOT be set to `null` or unset if both the `proj.wkt2` field or `proj.projjson` fields are set to `null` or unset.
89+
8890
#### geo -> proj.wkt2
8991

9092
WKT2 (ISO 19162) CRS representation
9193

92-
* **Type**: `["string", "null"]`
94+
* **Type**: `string | null`
9395
* **Required**: No
9496

9597
A Coordinate Reference System (CRS) is the data reference system (sometimes called a 'projection')
9698
used by the asset data. This value is a [WKT2](http://docs.opengeospatial.org/is/12-063r5/12-063r5.html) string.
9799

98-
This field SHOULD be set to `null` in the following cases:
100+
This field SHOULD be set to `null` or omitted in the following cases:
99101

100102
- The asset data does not have a CRS, such as in the case of non-rectified imagery with Ground Control Points.
101103
- A CRS exists, but there is no valid WKT2 string for it.
102104

105+
The `proj.wkt2` field MUST NOT be set to `null` or unset if both the `proj.code` field or `proj.projjson` fields are set to `null` or unset.
106+
103107
#### geo -> proj.projjson
104108

105109
PROJJSON CRS representation
106110

107-
* **Type**: `any`
111+
* **Type**: `object | null`
108112
* **Required**: No
109113

110114
A Coordinate Reference System (CRS) is the data reference system (sometimes called a 'projection')
111115
used by the asset data. This value is a [PROJJSON](https://proj.org/specifications/projjson.html) object,
112-
see the [JSON Schema](https://proj.org/schemas/v0.5/projjson.schema.json) for details.
116+
see the [JSON Schema](https://proj.org/schemas/v0.7/projjson.schema.json) for details.
113117

114-
This field SHOULD be set to `null` in the following cases:
118+
This field SHOULD be set to `null` or omitted in the following cases:
115119

116120
- The asset data does not have a CRS, such as in the case of non-rectified imagery with Ground Control Points.
117121
- A CRS exists, but there is no valid PROJJSON for it.
118122

123+
The `proj.projjson` field MUST NOT be set to `null` or unset if both the `proj.code` field or `proj.wkt2` fields are set to `null` or unset.
124+
119125
#### geo -> proj.bbox
120126

121127
Bounding box in CRS coordinates
122128

123-
* **Type**: `number` `[]`
129+
* **Type**: `number[4] | null`
124130
* **Required**: No
125131

126-
Bounding box of the assets represented by this Item in the asset data CRS. Specified as 4 coordinates
127-
based on the CRS defined in the `proj.code`, `proj.projjson` or `proj.wkt2` fields. First two numbers are coordinates
132+
Bounding box of the assets represented by this Item in the asset data CRS. Specified as 4 numbers
133+
based on the CRS defined in the `proj.code`, `proj.projjson` or `proj.wkt2` fields. The first two numbers are coordinates
128134
of the lower left corner, followed by coordinates of upper right corner, , e.g., \[west, south, east, north],
129135
\[xmin, ymin, xmax, ymax], \[left, down, right, up], or \[west, south, lowest, east, north, highest].
130136
The length of the array must be 2\*n where n is the number of dimensions. The array contains all axes of the southwesterly
@@ -135,7 +141,7 @@ based on [WGS 84](http://www.opengis.net/def/crs/OGC/1.3/CRS84).
135141

136142
Affine transformation coefficients
137143

138-
* **Type**: `number` `[]`
144+
* **Type**: `number[6] | null`
139145
* **Required**: No
140146

141147
Linear mapping from pixel coordinate space (Pixel, Line) to projection coordinate space (Xp, Yp). It is
@@ -167,7 +173,7 @@ proj_transform = [g[1], g[2], g[0],
167173

168174
Names of spatial dimensions [y_name, x_name]
169175

170-
* **Type**: `string` `[2]`
176+
* **Type**: `[string [2], null]`
171177
* **Required**: No
172178

173179
See the [Spatial Dimension Identification](#spatial-dimension-identification) section below for details on how spatial dimensions are identified.
@@ -191,6 +197,8 @@ The extension identifies these array dimensions through:
191197
{
192198
"geo": {
193199
"proj": {
200+
"version": "0.1",
201+
"code": "EPSG:4326",
194202
"spatial_dimensions": ["latitude", "longitude"]
195203
}
196204
}
@@ -235,6 +243,7 @@ When `proj` is defined under the `geo` dictionary at the group level but `spatia
235243
"attributes": {
236244
"geo": {
237245
"proj": {
246+
"version": "0.1",
238247
"code": "EPSG:4326",
239248
"transform": [0.1, 0.0, -180.0, 0.0, -0.1, 90.0]
240249
}
@@ -259,7 +268,9 @@ With data arrays:
259268

260269
- **Shape Inference**: Once spatial dimensions are identified (either explicitly through `spatial_dimensions` or through pattern-based detection), their sizes are obtained from the Zarr array's shape metadata
261270
- **Error Handling**: If spatial dimensions cannot be identified through either method, implementations MUST raise an error
262-
- **Semantic Identity Requirement**: If more than one CRS representation (`code`, `wkt2`, `projjson`) is provided, they MUST be semantically identical (i.e., describe the same coordinate reference system). Implementations SHOULD validate this consistency and raise an error if the representations describe different CRS
271+
- **Semantic Identity Requirement**: If more than one CRS representation (`code`, `wkt2`, `projjson`) is provided, they MUST be semantically consistent (i.e., describe the same coordinate reference system). Implementations SHOULD validate this consistency and raise an error if the representations describe different CRS.
272+
- **Unset keys** Unless otherwise stated, a key set to the value `null` is semantically equivalent to
273+
that key being omitted from the object that contains it.
263274

264275
### Shape Reconciliation
265276

@@ -296,6 +307,7 @@ This specification uses semantic versioning (SemVer) for version management:
296307
"attributes": {
297308
"geo": {
298309
"proj": {
310+
"version": "0.1",
299311
"code": "EPSG:3857",
300312
"transform": [156543.03392804097, 0.0, -20037508.342789244, 0.0, -156543.03392804097, 20037508.342789244],
301313
"bbox": [-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244]
@@ -315,6 +327,7 @@ This specification uses semantic versioning (SemVer) for version management:
315327
"attributes": {
316328
"geo": {
317329
"proj": {
330+
"version": "0.1",
318331
"code": "EPSG:32633",
319332
"spatial_dimensions": ["y", "x"],
320333
"transform": [30.0, 0.0, 500000.0, 0.0, -30.0, 5000000.0],
@@ -335,6 +348,7 @@ This specification uses semantic versioning (SemVer) for version management:
335348
"attributes": {
336349
"geo": {
337350
"proj": {
351+
"version": "0.1",
338352
"code": "EPSG:4326",
339353
"transform": [0.1, 0.0, -180.0, 0.0, -0.1, 90.0],
340354
"bbox": [-180.0, -90.0, 180.0, 90.0]
@@ -354,6 +368,7 @@ This specification uses semantic versioning (SemVer) for version management:
354368
"attributes": {
355369
"geo": {
356370
"proj": {
371+
"version": "0.1",
357372
"wkt2": "PROJCRS[\"WGS 84 / UTM zone 33N\",BASEGEOGCRS[\"WGS 84\",DATUM[\"World Geodetic System 1984\",ELLIPSOID[\"WGS 84\",6378137,298.257223563,LENGTHUNIT[\"metre\",1]]],PRIMEM[\"Greenwich\",0,ANGLEUNIT[\"degree\",0.0174532925199433]]],CONVERSION[\"UTM zone 33N\",METHOD[\"Transverse Mercator\",ID[\"EPSG\",9807]],PARAMETER[\"Latitude of natural origin\",0,ANGLEUNIT[\"degree\",0.0174532925199433]],PARAMETER[\"Longitude of natural origin\",15,ANGLEUNIT[\"degree\",0.0174532925199433]],PARAMETER[\"Scale factor at natural origin\",0.9996,SCALEUNIT[\"unity\",1]],PARAMETER[\"False easting\",500000,LENGTHUNIT[\"metre\",1]],PARAMETER[\"False northing\",0,LENGTHUNIT[\"metre\",1]]],CS[Cartesian,2],AXIS[\"easting\",east,ORDER[1],LENGTHUNIT[\"metre\",1]],AXIS[\"northing\",north,ORDER[2],LENGTHUNIT[\"metre\",1]]]",
358373
"transform": [30.0, 0.0, 500000.0, 0.0, -30.0, 5000000.0]
359374
}

attributes/geo/proj/schema.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"description": "PROJJSON CRS representation"
3030
},
3131
"bbox": {
32-
"type": "array",
32+
"type": ["array", "null"],
3333
"oneOf": [
3434
{
3535
"minItems": 4,
@@ -46,7 +46,7 @@
4646
"description": "Bounding box in CRS coordinates"
4747
},
4848
"transform": {
49-
"type": "array",
49+
"type": ["array", "null"],
5050
"oneOf": [
5151
{
5252
"minItems": 6,
@@ -63,7 +63,7 @@
6363
"description": "Affine transformation coefficients"
6464
},
6565
"spatial_dimensions": {
66-
"type": "array",
66+
"type": ["array", "null"],
6767
"minItems": 2,
6868
"maxItems": 2,
6969
"items": {

0 commit comments

Comments
 (0)