[Python] Converting h3 hex id to polygon in python

Discussão em 'Python' iniciado por Stack, Março 27, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to take a h3 hex id and convert it to a polygon to use in a geodataframe (and eventually export as a shapefile). All of the methods in h3 documented online don't seem to work for me, and cannot figure out what method to use.

    I'm using h3 3.7.6

    import h3
    h3.cells_to_multi_polygon('86264c28fffffff', geo_json=False)


    gives me AttributeError: module 'h3' has no attribute 'cells_to_multi_polygon' (reference: https://h3geo.org/docs/api/regions/)

    import h3
    h3.h3_to_geo_boundary('86264c28fffffff', geo_json=False)


    gives me AttributeError: module 'h3' has no attribute 'h3_to_geo_boundary' (reference: How to generate shapefiles for H3 hexagons in a particular area)

    import h3
    h3.cells_to_polygons('86264c28fffffff')


    gives me AttributeError: module 'h3' has no attribute 'cells_to_polygons' (reference: https://uber.github.io/h3-py/api_reference.html#h3.cells_to_polygons)

    those are the three methods that I've seen used in other posts (see references), none of these exist in the most recent version of h3 and I cannot figure out the correct one to use

    Continue reading...

Compartilhe esta Página