Skip to content

Commit 091e98b

Browse files
m-mohrgadomski
andauthored
Clarify/fix proj:epsg requirement (#15)
* Add more examples, clarify/fix `proj:epsg` requirement #7, align repo with template * Don't require proj:epsg as discussed in the STAC meeting * Clarification * Recommendation around thumbnails * Update README.md Co-authored-by: Pete Gadomski <[email protected]> --------- Co-authored-by: Pete Gadomski <[email protected]>
1 parent e34b6de commit 091e98b

File tree

5 files changed

+60
-35
lines changed

5 files changed

+60
-35
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212

1313
### Changed
1414

15+
- `proj:epsg` is not required in Item properties anymore. `proj:epsg` is recommended now, but not required in any scope.
1516
- Updated the PROJJSON schema to v0.5
1617

1718
### Deprecated
@@ -23,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2324
- Added missing scope "Collection" to Readme. The scope was already supported in JSON Schemas.
2425
- Clarify that `proj:wkt2` or `proj:projjson` should be used for complex (non-EPSG) CRS
2526
- Clarified which fields are required by GDAL
27+
- Recommendation for thumbnails
2628

2729
## [v1.0.0] - 2021-03-30
2830

README.md

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,27 @@ e.g., a UTM Zone. However, there may also be Assets intended for display, like a
1717
been reprojected to a different CRS, e.g., Web Mercator, or resized to better accommodate that use case. In this case, the
1818
fields should be specified at the Item Asset level, while those Item Asset objects that use the defaults can remain unspecified.
1919

20+
The `proj` prefix is short for "projection", and is not a reference to the PROJ/PROJ4 formats.
21+
2022
- Examples:
2123
- [Item example](examples/item.json): Shows the basic usage of the extension in a STAC Item
2224
- [Assets in Item example](examples/assets.json): Shows the basic usage of the extension in STAC Assets (in a STAC Item)
2325
- [Collection example](examples/collection.json): Shows the basic usage of the extension in a STAC Collection (Item Assets Definiton and Summaries)
2426
- [JSON Schema](json-schema/schema.json)
2527
- [Changelog](./CHANGELOG.md)
2628

27-
## Item Properties or Asset Fields
29+
## Fields
2830

29-
The `proj` prefix is short for "projection", and is not a reference to the PROJ/PROJ4 formats.
31+
The fields in the table below can be used in these parts of STAC documents:
32+
- [ ] Catalogs
33+
- [x] Collections
34+
- [x] Item Properties (incl. Summaries in Collections)
35+
- [x] Assets (for both Collections and Items, incl. Item Asset Definitions in Collections)
36+
- [ ] Links
3037

3138
| Field Name | Type | Description |
3239
| ---------------- | ------------------------ | ----------- |
33-
| proj:epsg | integer\|null | **REQUIRED.** [EPSG code](http://www.epsg-registry.org/) of the datasource |
40+
| proj:epsg | integer\|null | [EPSG code](http://www.epsg-registry.org/) of the datasource |
3441
| proj:wkt2 | string\|null | [WKT2](http://docs.opengeospatial.org/is/12-063r5/12-063r5.html) string representing the Coordinate Reference System (CRS) that the `proj:geometry` and `proj:bbox` fields represent |
3542
| proj:projjson | [PROJJSON Object](https://proj.org/specifications/projjson.html)\|null | PROJJSON object representing the Coordinate Reference System (CRS) that the `proj:geometry` and `proj:bbox` fields represent |
3643
| proj:geometry | [GeoJSON Geometry Object](https://tools.ietf.org/html/rfc7946#section-3.1) | Defines the footprint of this Item. |
@@ -39,6 +46,21 @@ The `proj` prefix is short for "projection", and is not a reference to the PROJ/
3946
| proj:shape | \[integer] | Number of pixels in Y and X directions for the default grid |
4047
| proj:transform | \[number] | The affine transformation coefficients for the default grid |
4148

49+
At least one of the fields MUST be specified, but it is RECOMMENDED to provide more information as detailed in the
50+
[Best Practices section](#best-practices) so that, for example, GDAL can read your data without issues.
51+
52+
Also, [version 1.0.0](https://github.com/stac-extensions/projection/releases/tag/v1.0.0) of this extension
53+
required `proj:epsg` (either as integer or null) in Item Properties.
54+
This is not required anymore, but it is still recommended to additionally provide an EPSG code whenever available.
55+
56+
Generally, it is preferrable to provide the projection information on the Asset level
57+
as they are specific to assets and may not apply to all assets.
58+
For example, if you provide a smaller and unlocated thumbnail, having the projection information in the Item Properties
59+
would imply that the projection information also applies to the thumbnail if not specified otherwise in the asset.
60+
You may want to add the EPSG code to the Item Properties though as this would provide an easy way to
61+
filter for specific EPSG codes in an API.
62+
In this case you could override the EPSG code for the thumbnail on the asset level.
63+
4264
### Additional Field Information
4365

4466
#### proj:epsg
@@ -48,7 +70,7 @@ A Coordinate Reference System (CRS) is the data reference system (sometimes call
4870
[EPSG code](https://en.wikipedia.org/wiki/EPSG_Geodetic_Parameter_Dataset).
4971
A great tool to help find EPSG codes is [epsg.io](http://epsg.io/).
5072

51-
This field must be set to `null` in the following cases:
73+
This field SHOULD be set to `null` in the following cases:
5274
- The asset data does not have a CRS, such as in the case of non-rectified imagery with Ground Control Points.
5375
- 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`.
5476
Clients can prefer to take either, although there may be discrepancies in how each might be interpreted.
@@ -58,7 +80,7 @@ This field must be set to `null` in the following cases:
5880
A Coordinate Reference System (CRS) is the data reference system (sometimes called a 'projection')
5981
used by the asset data. This value is a [WKT2](http://docs.opengeospatial.org/is/12-063r5/12-063r5.html) string.
6082

61-
This field should be set to `null` in the following cases:
83+
This field SHOULD be set to `null` in the following cases:
6284
- The asset data does not have a CRS, such as in the case of non-rectified imagery with Ground Control Points.
6385
- A CRS exists, but there is no valid WKT2 string for it.
6486

@@ -68,7 +90,7 @@ A Coordinate Reference System (CRS) is the data reference system (sometimes call
6890
used by the asset data. This value is a [PROJJSON](https://proj.org/specifications/projjson.html) object,
6991
see the [JSON Schema](https://proj.org/schemas/v0.5/projjson.schema.json) for details.
7092

71-
This field should be set to `null` in the following cases:
93+
This field SHOULD be set to `null` in the following cases:
7294
- The asset data does not have a CRS, such as in the case of non-rectified imagery with Ground Control Points.
7395
- A CRS exists, but there is no valid WKT2 string for it.
7496

@@ -138,17 +160,17 @@ proj_transform = [g[1], g[2], g[0],
138160

139161
This object represents the centroid of the Item Geometry.
140162

141-
| Field Name | Type | Description |
142-
| ------------------- | ------ | ------------------------------------------------------------ |
143-
| lat | number | The latitude of the centroid. |
144-
| lon | number | The longitude of the centroid. |
163+
| Field Name | Type | Description |
164+
| ---------- | ------ | ------------------------------ |
165+
| lat | number | The latitude of the centroid. |
166+
| lon | number | The longitude of the centroid. |
145167

146168
## Best Practices
147169

148170
There are several projection extension fields with potentially overlapping functionality. This section attempts to
149171
give an overview of which ones you should consider using. They fit into three general categories:
150172

151-
- **Description of the coordinate reference system:** [EPSG code](#projepsg) is the default, but it is just a reference to known
173+
- **Description of the coordinate reference system:** [EPSG code](#projepsg) is recommended, but it is just a reference to known
152174
projection information. [WKT2](#projwkt2) and [PROJJSON](#projprojjson) are two options to fully describe the projection information.
153175
This is typically done for projections that aren't available or fully described in the [EPSG Registry](https://epsg.org/).
154176
For example, the MODIS Sinusoidal projection does not have an EPSG code, but can be described using WKT2 or PROJJSON.
@@ -186,6 +208,20 @@ WKT2 and PROJJSON are equivalent to one another - more clients understand WKT2,
186208
structure, since they are both JSON. For now it's probably best to use both for maximum interoperability, but just using PROJJSON
187209
is likely ok if you aren't worried about legacy client support.
188210

211+
### Thumbnails
212+
213+
For (unlocated) thumbnails and similar imagery, it is recommended set `proj:epsg` to `null` and include `proj:shape`
214+
so that
215+
1. clients can read the image dimensions upfront (and reserve space for them), and
216+
2. you explicitly state that the thumbnail is not geolocated.
217+
218+
This is also recommended in case you have 'global' projection information in the Item properties.
219+
The fields on the asset level override the Item Properties and as such client don't apply the 'global' projection details
220+
falsely to the thumbnails.
221+
222+
Client implementations should be careful about the order in `proj:shape`.
223+
Usually, image dimensions are given in width-height (x-y) order, but `proj:shape` lists the height first.
224+
189225
## Contributing
190226

191227
All contributions are subject to the

examples/assets.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"created": "2020-12-12T01:48:13.725Z",
4444
"updated": "2020-12-12T01:48:13.725Z",
4545
"platform": "cool_sat2",
46-
"proj:epsg": null,
46+
"proj:epsg": 32659,
4747
"instruments": [
4848
"cool_sensor_v1"
4949
]
@@ -84,6 +84,11 @@
8484
"thumbnail": {
8585
"href": "https://storage.googleapis.com/open-cogs/stac-examples/20201211_223832_CS2.jpg",
8686
"title": "Thumbnail",
87+
"proj:epsg": null,
88+
"proj:shape": [
89+
800,
90+
800
91+
],
8792
"type": "image/png",
8893
"roles": [
8994
"thumbnail"

examples/item.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,6 @@
8080
"data"
8181
]
8282
},
83-
"thumbnail": {
84-
"href": "https://storage.googleapis.com/open-cogs/stac-examples/20201211_223832_CS2.jpg",
85-
"title": "Thumbnail",
86-
"type": "image/png",
87-
"roles": [
88-
"thumbnail"
89-
]
90-
},
9183
"visual": {
9284
"href": "https://storage.googleapis.com/open-cogs/stac-examples/20201211_223832_CS2.tif",
9385
"type": "image/tiff; application=geotiff; profile=cloud-optimized",

json-schema/schema.json

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
"$id": "https://stac-extensions.github.io/projection/v1.0.0/schema.json",
44
"title": "Projection Extension",
55
"description": "STAC Projection Extension for STAC Items.",
6+
"$comment": "This schema succeeds if the proj: fields are not used at all, please keep this in mind.",
67
"oneOf": [
78
{
89
"$comment": "This is the schema for STAC Items.",
910
"allOf": [
11+
{
12+
"$ref": "#/definitions/stac_extensions"
13+
},
1014
{
1115
"type": "object",
1216
"required": [
@@ -19,17 +23,7 @@
1923
"const": "Feature"
2024
},
2125
"properties": {
22-
"allOf": [
23-
{
24-
"$comment": "Require fields here for item properties.",
25-
"required": [
26-
"proj:epsg"
27-
]
28-
},
29-
{
30-
"$ref": "#/definitions/fields"
31-
}
32-
]
26+
"$ref": "#/definitions/fields"
3327
},
3428
"assets": {
3529
"type": "object",
@@ -38,9 +32,6 @@
3832
}
3933
}
4034
}
41-
},
42-
{
43-
"$ref": "#/definitions/stac_extensions"
4435
}
4536
]
4637
},
@@ -92,7 +83,6 @@
9283
}
9384
},
9485
"fields": {
95-
"$comment": "Add your new fields here. Don't require them here, do that above in the item schema.",
9686
"type": "object",
9787
"properties": {
9888
"proj:epsg":{

0 commit comments

Comments
 (0)