Only Polygon GeoJSON supported #783
-
|
I'm fairly green with h3 so forgive me if this is ignorance on my behalf. I'm plotting a polygon of a landmass which i generated at geojson.io and trying to collect all the res8 hexagons within that geojson. below is a snippet of what i'm passing. With js it manages to extract this data correctly with {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [[
[142.2390605330495, -10.005513897126036], [141.16591324118713, -11.184615012913895]
....
]]
}
}
]
}when I try to pass this with python using python, i get a Is the geojson structured correctly? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
This is a better question for the |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for your quick response. Apologies if I have hit the wrong repo here, your advice is probably correct. geo = geojson['features'][0]['geometry']
# return list of all hexes
print(h3.polyfill_geojson(geo, 8))
# print all hexes...
[print(x) for x in h3.polyfill_geojson(geo, 8)] |
Beta Was this translation helpful? Give feedback.
This is a better question for the
h3-pyrepo, but I believe the issue here is that you can't pass aFeatureCollection, or any feature that's not aPolygon, topolyfill_geojson. You'll need to iterate through your features one by one, e.g.