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

Update docs to match h3-py v4.x #938

Merged
merged 27 commits into from
Oct 27, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 22 additions & 12 deletions website/docs/api/regions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ These functions convert H3 indexes to and from polygonal areas.

## polygonToCells

Each binding's version of `polygonToCells` takes as input a GeoJSON-like data
structure describing a polygon (i.e., an outer ring and optional holes) and
a target cell resolution.
It produces a collection of cells that are contained within the polygon.

Containment is determined by centroids of the cells, so that a partitioning
of polygons (covering an area without overlaps) will result in
a partitioning of H3 cells.
ajfriend marked this conversation as resolved.
Show resolved Hide resolved

<Tabs
groupId="language"
defaultValue="c"
Expand All @@ -29,6 +38,11 @@ These functions convert H3 indexes to and from polygonal areas.
H3Error polygonToCells(const GeoPolygon *geoPolygon, int res, uint32_t flags, H3Index *out);
```

`polygonToCells` takes a `GeoPolygon` struct and preallocated,
zeroed memory, and fills it with the covering cells.

Returns 0 (`E_SUCCESS`) on success.

</TabItem>
<TabItem value="java">

Expand Down Expand Up @@ -60,9 +74,15 @@ function example() {
<TabItem value="python">

```py
h3.polygon_to_cells(polygons, res, geo_json_conformant=False)
h3.polygon_to_cells(h3shape, res)
h3.h3shape_to_cells(h3shape, res)
ajfriend marked this conversation as resolved.
Show resolved Hide resolved
```

In Python, `h3shape_to_cells` takes an `H3Shape` object
(`LatLngPoly` or `LatLngMultiPoly`).
Note that `polygon_to_cells` is an alias for `h3shape_to_cells`.
For more info, see the [`h3-py` docs](https://uber.github.io/h3-py/api_quick.html#polygon-interface).

</TabItem>
<TabItem value="shell">

Expand All @@ -87,16 +107,6 @@ $ h3 polygonToCells -r 7 -p "[[37.813318999983238, -122.4089866999972145], [37.7
</TabItem>
</Tabs>

polygonToCells takes a given GeoJSON-like data structure and preallocated,
zeroed memory, and fills it with the hexagons that are contained by
the GeoJSON-like data structure.

Containment is determined by the cells' centroids. A partitioning
using the GeoJSON-like data structure, where polygons cover an area
without overlap, will result in a partitioning in the H3 grid, where
cells cover the same area without overlap.

Returns 0 (`E_SUCCESS`) on success.

### maxPolygonToCellsSize

Expand Down Expand Up @@ -217,7 +227,7 @@ function example() {
<TabItem value="python">

```py
h3.cells_to_multi_polygon(hexes, geo_json=False)
h3.cells_to_h3shape(cells, *, tight=True)
```

</TabItem>
Expand Down
Loading