Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

h3.h3shape_to_cells | Error message unclear #365

Closed
fhk opened this issue May 9, 2024 · 2 comments
Closed

h3.h3shape_to_cells | Error message unclear #365

fhk opened this issue May 9, 2024 · 2 comments

Comments

@fhk
Copy link

fhk commented May 9, 2024

When reading some geojson files there are 3 coords, x, y, and z.

This breaks the call in:

h3.h3shape_to_cells

It is however still possible to make a h3.H3Poly

Repro

    usa = gpd.read_file('https://raw.githubusercontent.com/scdoshi/us-geojson/master/geojson/nation/US.geojson')
    usa = list(usa.geometry.iloc[0].geoms)[0]
    print(usa.exterior.coords[:])
    poly = h3.H3Poly(usa.exterior.coords[:])
    print(poly.outer)
    out = h3.h3shape_to_cells(poly, res=7)

Error

stderr
---
  File "<udf>", line 39, in udf
  File "/app/server_rt2/.venv/lib/python3.11/site-packages/h3/api/basic_str/__init__.py", line 427, in h3shape_to_cells
    mv = _cy.polygon_to_cells(poly.outer, res, holes=poly.holes)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "latlng.pyx", line 160, in h3._cy.latlng.polygon_to_cells
  File "latlng.pyx", line 108, in h3._cy.latlng.GeoPolygon.__cinit__
  File "latlng.pyx", line 77, in h3._cy.latlng.make_geoloop
ValueError: too many values to unpack (expected 2)
@ajfriend
Copy link
Contributor

I think this has the same underlying issue as #366. We just need to implement #368

@ajfriend
Copy link
Contributor

This should be fixed with https://github.com/uber/h3-py/releases/tag/v4.0.0b5, so I'll close this. Please let me know if you have any issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants