Skip to content

Commit 8083762

Browse files
committed
review updates
1 parent 741bb40 commit 8083762

File tree

3 files changed

+892
-24
lines changed

3 files changed

+892
-24
lines changed

docs/crs.md

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,50 @@
11
# Coordinate Reference System (CRS)
22

3+
STAC bounding boxes and geometries require that values be described by the
4+
[WGS84][wgs84] datum. However, the input metadata may describe coordinates
5+
using other systems. In order to correctly translate the coordinates to [WGS84][wgs84] compliant values,
6+
STAC populator must know what is the CRS of the original values.
7+
8+
STAC populator will transform the coordinates from the specified CRS to [EPSG:4326][epsg4326]
9+
(for 2D coordinates) or [EPSG:4979][epsg4979] (for 3D coordinates) when creating bounding boxes and
10+
geometries for STAC Items and Collections. Both of these CRSs are compliant with the STAC specification.
11+
312
When running a populator implementation, the STAC populator assumes that the metadata from the files will specify
413
which CRS is used to represent the geospatial coordinates in the data.
514

615
For example, The `THREDDSPopulator` parses metadata from NCML metadata and looks for values named
716
`geospatial_bounds_crs` (and optionally `geospatial_bounds_crs_vertical`) to determine the CRS.
817

9-
If these values are not specified then the CRS is unknown and STAC populator will not know how to convert the
10-
geospatial coordinates to a CRS that STAC accepts. If nothing is specified, then STAC populator will assume
11-
that the CRS is EPSG:4326 (for 2D coordinates) or EPSG:4979 (for 3D coordinates).
18+
If these values are not specified then the CRS is unknown and STAC populator will not know how to transform the
19+
geospatial coordinates to a CRS that STAC accepts.
20+
21+
If nothing is specified, then STAC populator will assume that the CRS is [EPSG:4326][epsg4326]
22+
(for 2D coordinates) or [EPSG:4979][epsg4979] (for 3D coordinates).
1223

1324
To specify a different fallback CRS then use the `--fallback-crs` command line option. If you think that the CRS
1425
specified in the metadata is incorrect and want to force STAC populator to use a different CRS even if one is
1526
specified, use the `--force-crs` option instead.
1627

28+
The following precedence order is followed when STAC populator chooses which CRS to use:
29+
30+
1. CRS specified by `--force-crs` command line option
31+
2. CRS specified in the metadata file being converted to a STAC item
32+
3. CRS specified by the `--fallback-crs` command line option
33+
4. [EPSG:4326][epsg4326] (for 2D coordinates) or [EPSG:4979][epsg4979] (for 3D coordinates)
34+
35+
Note that STAC populator will only transform coordinates to [WGS84][wgs84] compliant values when required by the
36+
STAC specification. Other STAC extensions are free to represent the coordinates in any way they want.
37+
For example, the [datacube extension][datacube] extension allows coordinates to be represented in any CRS so
38+
STAC populator will not attempt to transform these coordinates for the `cube:dimensions` property.
39+
1740
## Useful CRS representations
1841

1942
### WGS84 but with longitude from 0-360 degrees
2043

21-
If your data contains longitude values from 0-360 degrees instead of -180-180 (as required by WGS84) you can use the
22-
following CRS that is identical to EPSG:4979 except that the prime meridian is shifted.
23-
This means that longitude values between 0-360 are properly converted to WGS84 when transformed to a WGS84 compliant CRS.
44+
If your data contains longitude values from [0, 360] degrees instead of [-180, 180] (as required by [WGS84][wgs84]) you
45+
can use the following CRS that is identical to [EPSG:4979][epsg4979] except that the prime meridian is shifted.
46+
This means that longitude values between [0, 360] are properly transformed to the [-180, 180] range when transformed to
47+
a [WGS84][wgs84] compliant CRS.
2448

2549
```text
2650
GEOGCRS["WGS 84",
@@ -32,23 +56,19 @@ GEOGCRS["WGS 84",
3256
AXIS["ellipsoidal height (h)",up,ORDER[3],LENGTHUNIT["metre",1]]]
3357
```
3458

35-
Note that the biggest difference between this and EPSG:4979 is the section: `PRIMEM["Greenwich",-360`.
36-
37-
### WGS84 but with longitude and axes switched
59+
Note that the biggest difference between this and [EPSG:4979][epsg4979] is the section: `PRIMEM["Greenwich",-360`.
3860

39-
If your data represents coordinates with longitude on the x axis and latitude on the y axis you can use the following
40-
CRS that is identical to EPSG:4979 except that the first two axes are swapped.
61+
### EPSG:4979 or EPSG:4326 but with longitude and axes switched
4162

42-
```text
43-
GEOGCRS["WGS 84",
44-
DATUM["based on WGS 84 ellipsoid",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],
45-
PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],
46-
CS[ellipsoidal,3],
47-
AXIS["geodetic longitude (Lon)",east,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],
48-
AXIS["geodetic latitude (Lat)",north,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],
49-
AXIS["ellipsoidal height (h)",up,ORDER[3],LENGTHUNIT["metre",1]]]
50-
```
51-
52-
Note the order of the `AXIS` sections.
63+
If your data represents coordinates with longitude on the x axis and latitude on the y axis you can use
64+
[OGC:CRS84h][ogccrs84h] which is similar to [EPSG:4979][epsg4979] except that the first two axes are swapped or
65+
[OGC:CRS84][ogccrs84] which is similar to [EPSG:4326][epsg4326] except that the first two axes are swapped.
5366

5467
<!-- TODO: add more examples here as they come up -->
68+
69+
[epsg4326]: https://epsg.io/4326
70+
[epsg4979]: https://epsg.io/4979
71+
[wgs84]: https://www.opengis.net/def/crs/OGC/1.3/CRS84
72+
[ogccrs84h]: https://spatialreference.org/ref/ogc/CRS84h/
73+
[ogccrs84]: https://spatialreference.org/ref/ogc/CRS84/
74+
[datacube]: https://stac-extensions.github.io/datacube/v2.3.0/schema.json

0 commit comments

Comments
 (0)