Skip to content

ValueError: Can't create geoarrow.types.Crs from 4326 #73

@kylebarron

Description

@kylebarron

This might be expected if geoarrow-types hasn't yet updated to the latest support for non-projjson CRS representations in 0.2?

If it's not expected, I can create a more detailed repro. I don't have an easy repro here because passing a crs argument to geoarrow-rust will automatically use pyproj to convert to PROJJSON. In geodatafusion I'm assigning a CRS with SRID 4326 when calling ST_Point(x, y, 4326). You can see my SQL call here: https://github.com/developmentseed/lonboard/blob/751f1a1a3d35d078758f51c4ef422e04dd45bd01/examples/nyc_taxi_trips.py#L137-L138

Traceback (most recent call last):
  File "/Users/kyle/.cache/uv/archive-v0/N2xYiaCnXio3dQ-xoXvod/lib/python3.12/site-packages/marimo/_output/formatting.py", line 231, in try_format
    mimetype, data = formatter(obj)
                     ^^^^^^^^^^^^^^
  File "/Users/kyle/.cache/uv/archive-v0/N2xYiaCnXio3dQ-xoXvod/lib/python3.12/site-packages/marimo/_output/formatters/repr_formatters.py", line 107, in f_repr
    contents = method()
               ^^^^^^^^
  File "/Users/kyle/.cache/uv/archive-v0/N2xYiaCnXio3dQ-xoXvod/lib/python3.12/site-packages/datafusion/dataframe.py", line 327, in _repr_html_
    return self.df._repr_html_()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kyle/.cache/uv/archive-v0/N2xYiaCnXio3dQ-xoXvod/lib/python3.12/site-packages/datafusion/dataframe_formatter.py", line 303, in format_html
    html.extend(self._build_table_header(schema))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kyle/.cache/uv/archive-v0/N2xYiaCnXio3dQ-xoXvod/lib/python3.12/site-packages/datafusion/dataframe_formatter.py", line 379, in _build_table_header
    for field in schema:
                 ^^^^^^
  File "pyarrow/types.pxi", line 2907, in __iter__
  File "pyarrow/types.pxi", line 2903, in pyarrow.lib.Schema.__getitem__
  File "pyarrow/types.pxi", line 3209, in pyarrow.lib.Schema._field
  File "pyarrow/public-api.pxi", line 185, in pyarrow.lib.pyarrow_wrap_field
  File "pyarrow/types.pxi", line 2495, in pyarrow.lib.Field.init
  File "pyarrow/public-api.pxi", line 129, in pyarrow.lib.pyarrow_wrap_data_type
  File "/Users/kyle/.cache/uv/archive-v0/N2xYiaCnXio3dQ-xoXvod/lib/python3.12/site-packages/geoarrow/types/type_pyarrow.py", line 62, in __arrow_ext_deserialize__
    return _deserialize_storage(
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kyle/.cache/uv/archive-v0/N2xYiaCnXio3dQ-xoXvod/lib/python3.12/site-packages/geoarrow/types/type_pyarrow.py", line 619, in _deserialize_storage
    spec = TypeSpec.from_extension_metadata(extension_metadata).with_defaults(spec)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kyle/.cache/uv/archive-v0/N2xYiaCnXio3dQ-xoXvod/lib/python3.12/site-packages/geoarrow/types/type_spec.py", line 275, in from_extension_metadata
    out_crs = crs.create(metadata["crs"])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kyle/.cache/uv/archive-v0/N2xYiaCnXio3dQ-xoXvod/lib/python3.12/site-packages/geoarrow/types/crs.py", line 322, in create
    raise ValueError(f"Can't create geoarrow.types.Crs from {obj}")
ValueError: Can't create geoarrow.types.Crs from 4326

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