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

_feature_extrema() in burntiles.py does not handle multigeometry types #47

Open
iboates opened this issue Mar 27, 2021 · 2 comments
Open

Comments

@iboates
Copy link

iboates commented Mar 27, 2021

Hi,

I don't actually know much about this library but I had a problem when using robosat where multipolygons were causing a breakdown

I eventually tracked it down to this function in burntiles.py. A multipolygon causes it to crash out due to the case not being handled in the if/elif construct and there is no else statement.

Like I said I don't know much about this library so I don't know if it is possible to make this handle multigeometry types. If not then maybe it should throw a more descriptive error.

Cheers

@philvarner
Copy link

I encountered this same issue.

  File "/Users/philvarner/code/titiler/venv/lib/python3.8/site-packages/supermercado/burntiles.py", line 78, in burn
    bounds = find_extrema(polys)
  File "/Users/philvarner/code/titiler/venv/lib/python3.8/site-packages/supermercado/burntiles.py", line 44, in find_extrema
    *[_feature_extrema(f["geometry"]) for f in features]
  File "/Users/philvarner/code/titiler/venv/lib/python3.8/site-packages/supermercado/burntiles.py", line 44, in <listcomp>
    *[_feature_extrema(f["geometry"]) for f in features]
  File "/Users/philvarner/code/titiler/venv/lib/python3.8/site-packages/supermercado/burntiles.py", line 38, in _feature_extrema
    return min(x), min(y), max(x), max(y)
UnboundLocalError: local variable 'x' referenced before assignment

even if MultiPolygon can't be supported here, it would be nice to have an else that raises a clear exception, rather than this incidental one.

@mob5566
Copy link

mob5566 commented Mar 8, 2022

Hi folks,

I tried to solve this problem with pull request #50 (supporting MultiPolygon), and it works for me.

You may try that commit too.

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

3 participants