I have a set of multipolygons in GeoJSON format, for example:
{
"type": "MultiPolygon",
"coordinates": [
[[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],
[[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],
[[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]
]
}
I'm trying to use the polyfill_geojson
method in the H3 library to get the hexagons that fall within it. But it seems like this method only supports Polygons and not multipolygons:
>>> h3.polyfill_geojson(geojson, 8)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "python3.7/site-packages/h3/api/_api_template.py", line 486, in polyfill_geojson
mv = _cy.polyfill_geojson(geojson, res)
File "geo.pyx", line 186, in h3._cy.geo.polyfill_geojson
ValueError: Only Polygon GeoJSON supported
How can I get the H3 hexagons from a Multipolygon GeoJSON?