pystac-client icon indicating copy to clipboard operation
pystac-client copied to clipboard

Property proj:epsg is remapped to proj:code

Open dwest77a opened this issue 9 months ago • 8 comments

I've noticed that an item with proj:epsg set to some value (e.g 32621) is remapped/altered at some point by the pystac client to read proj:code = EPSG:32621 instead. Is this a recent change by the client, or being caused by some other package/extension? Thanks

dwest77a avatar Jul 21 '25 15:07 dwest77a

An example can be found when loading https://api.stac.ceda.ac.uk/collections/cci_openeo_test/items/ndvi-example-stac-item1

dwest77a avatar Jul 21 '25 15:07 dwest77a

Yup, this is intentional as a part of the upgrade to v2.0 of the projection extension: https://github.com/stac-utils/pystac/blob/795befab413b4ea38afce314815801a0ab3db6b7/pystac/extensions/projection.py#L480-L481

There's ways to (de)serialize pystac items while skipping that migration path but it's often awkward. Unfortunately the documentation is pretty thin on this point -- one small example is the migrate argument here: https://pystac.readthedocs.io/en/stable/api/pystac.html#pystac.STACObject.from_dict.

In general, pystac does not have any fidelity guarantees for (de)serialization.

gadomski avatar Jul 21 '25 16:07 gadomski

Just want to point out that the stac_extensions list is also updated on the item to point to projection extension v2 so the returned item is valid.

jsignell avatar Jul 22 '25 17:07 jsignell

Ok thanks, sounds like I may need to remove one or both of the extensions applied to the item, as I need the proj:epsg property for use with OpenEO client - this is a required parameter for all items.

dwest77a avatar Jul 23 '25 10:07 dwest77a

Can you point me to where that's defined? It'd be good to update that, if possible -- you won't be the only person who runs into this.

Also, if proj v2 support was added in pystac v1.12.0, so you could require pystac < 1.12 in your project.

gadomski avatar Jul 23 '25 11:07 gadomski

Is pystac v1.12 required for the projections v2 support? I have encountered the issue that using the v2 specification does not work for the latest openeo-processes-dask version, which requires pystac < 1.12.

The v1.1.0 specification and syntax does work for openeo-processes-dask 2025.7.1, but possibly for the reasons above does not work with v2.0.0 as the proj:code syntax is not handled correctly.

dwest77a avatar Jul 23 '25 15:07 dwest77a

Following up on this, it looks like pystac v1.12 is required for v2 specification support, which means it is not yet supported in openeo.

dwest77a avatar Jul 23 '25 15:07 dwest77a

Is pystac v1.12 required for the projections v2 support?

pystac v1.12 can read items w/ projection extension v2 just fine, you just won't get any of the Python API for the extension (e.g. item.ext.proj.code). In general, you can always get to "unsupported" attributes via extra_fields, e.g.:

item.extra_fields["proj:code"]

gadomski avatar Jul 23 '25 15:07 gadomski