Skip to content

Add format_as_geojson option to cell_to_boundary() #454

@nojimatakashi55

Description

@nojimatakashi55

Feature Request: Add GeoJSON coordinate order option to cell_to_boundary()

In h3-js, the function cellToBoundary(cell, formatAsGeoJson) allows switching the coordinate order to [lng, lat], which is compliant with the GeoJSON standard.

Similarly, in h3-py v3.x, h3_to_geo_boundary(h, geo_json=True) provided the same capability.

However, in the current version (v4.x), h3-py lacks this option.
The function cell_to_boundary(h) always returns coordinates as (lat, lng) tuples, which requires manual conversion for compatibility with GeoJSON, Shapely, or GeoPandas.

Proposal

Introduce an optional argument to cell_to_boundary():

cell_to_boundary(h, format_as_geojson=False)

When format_as_geojson=True, the function would return (lng, lat) coordinate tuples.

This change would:

  • Restore functionality that existed in v3.x
  • Improve interoperability with other geospatial tools
  • Align the Python API more closely with h3-js.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions