Skip to content

Problem with some CRS transformations #261

Description

@glaroc

We have a problem with some collections in our STAC catalog that are in less common reference systems.

For example, this collection has one item in epsg:3347, and a simple stack() produces an error, even when not changing the CRS from the input source.

import pystac_client
import stackstac

catalog = pystac_client.Client.open("https://io.biodiversite-quebec.ca/stac")

items = catalog.search(
    collections=["pither_functional_connectivity"]
).item_collection()
stack = stackstac.stack(items, resolution=300, epsg=3347, bounds=(7227806, 1242748, 7602593, 1529390))

Here is the error

Traceback (most recent call last):
  File "/home/glaroc/.vscode/extensions/ms-python.python-2024.18.0-linux-x64/python_files/python_server.py", line 130, in exec_user_input
    retval = callable_(user_input, user_globals)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 1, in <module>
  File "/home/glaroc/.local/lib/python3.12/site-packages/stackstac/stack.py", line 290, in stack
    asset_table, spec, asset_ids, plain_items = prepare_items(
                                                ^^^^^^^^^^^^^^
  File "/home/glaroc/.local/lib/python3.12/site-packages/stackstac/prepare.py", line 260, in prepare_items
    asset_bbox_proj = geom_utils.reproject_bounds(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/glaroc/.local/lib/python3.12/site-packages/stackstac/geom_utils.py", line 52, in reproject_bounds
    xs_proj, ys_proj = transformer.transform(xs, ys, errcheck=True)  # TODO handle error
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pyproj/transformer.py", line 843, in transform
    self._transformer._transform(
  File "pyproj/_transformer.pyx", line 726, in pyproj._transformer._Transformer._transform
pyproj.exceptions.ProjError: transform error: Invalid coordinate: (Internal Proj Error: lcc: Invalid latitude)

Any help or guidance as to why this could be happening would be appreciated. We don't have this problem with other collections. Happens with stackstac==0.5.1 and pyproj==3.6.1.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions