Skip to content

Commit 870c6ce

Browse files
m-mohrgadomski
authored andcommitted
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 788b9d3 commit 870c6ce

File tree

5 files changed

+59
-34
lines changed

5 files changed

+59
-34
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: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,23 @@ 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
| ---------------- | ------------------------ | ----------- |
@@ -41,6 +48,21 @@ The `proj` prefix is short for "projection", and is not a reference to the PROJ/
4148
| proj:shape | \[integer] | Number of pixels in Y and X directions for the default grid |
4249
| proj:transform | \[number] | The affine transformation coefficients for the default grid |
4350

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

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

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

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

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

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

@@ -140,17 +162,17 @@ proj_transform = [g[1], g[2], g[0],
140162

141163
This object represents the centroid of the Item Geometry.
142164

143-
| Field Name | Type | Description |
144-
| ------------------- | ------ | ------------------------------------------------------------ |
145-
| lat | number | The latitude of the centroid. |
146-
| lon | number | The longitude of the centroid. |
165+
| Field Name | Type | Description |
166+
| ---------- | ------ | ------------------------------ |
167+
| lat | number | The latitude of the centroid. |
168+
| lon | number | The longitude of the centroid. |
147169

148170
## Best Practices
149171

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

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

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

193229
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/v2.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:code"
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:authority":{

0 commit comments

Comments
 (0)