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

Can't create mosaic when geometry have different number of points ? #81

Closed
vincentsarago opened this issue Jun 21, 2020 · 2 comments
Closed

Comments

@vincentsarago
Copy link
Member

Bug found while working on #80

import requests
from pygeos import polygons
headers = {
    "Content-Type": "application/json",
    "Accept-Encoding": "gzip",
    "Accept": "application/geo+json",
}
data = requests.post("https://earth-search.aws.element84.com/v0/search", headers=headers).json()
dataset_geoms = polygons(
    [feat["geometry"]["coordinates"][0] for feat in data["features"]]
)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-13-083d9d799f2d> in <module>
      1 dataset_geoms = polygons(
----> 2     [feat["geometry"]["coordinates"][0] for feat in data["features"]]
      3 )

pygeos/creation.py in polygons(shells, holes)
     88 
     89     if holes is None:
---> 90         return lib.polygons_without_holes(shells)
     91 
     92     holes = np.asarray(holes)

TypeError: One of the arguments is of incorrect type. Please provide only Geometry objects.

seems to be related to pygeos/pygeos#138

cc @kylebarron

@vincentsarago
Copy link
Member Author

Quick fix ?

try:
    dataset_geoms = polygons(
        [feat["geometry"]["coordinates"][0] for feat in features]
    )
except TypeError:
    dataset_geoms = [
        [polygons(feat["geometry"]["coordinates"][0]) for feat in features]
    ]

@vincentsarago
Copy link
Member Author

fixed in #82

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

1 participant