Skip to content

STAC to eo3 conversions fails when CRS is not an EPSG code (rasterio 1.4.2+) #622

@omad

Description

@omad

Some of the dc_tools use a built in STAC to eo3 converter in the apps/dc_tools/_stac.py. In particular, the tools for indexing the Copernicus DEM and ESA Worldcover products.

This conversion function doesn't handle CRSs in any form that isn't an EPSG code.

In rasterio 1.4.2+ it's not returning a dataset CRS as WKT2, whereas older versions returned it as a CRS.

rasterio 1.4.2

(Pdb) dataset.crs
CRS.from_wkt('GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]]')

rasterio 1.4.1

(Pdb) dataset.crs
CRS.from_epsg(4326)
(Pdb) interact
*interactive*
>>> import rasterio
>>> rasterio.__version__
'1.4.1'

This can be fixed by either updating the stac_transform() function, which shouldn't be too hard.

The better long term option is to use a different conversion function from odc-stac or eo-datasets. See: #615

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions