diff --git a/CHANGELOG.md b/CHANGELOG.md index bc5d00d..a55309c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,11 @@ All notable changes to this project will be documented in this file. This librar ## [Unreleased] ### Added -- `cellToChildPos` and `childPosToCell` functions. (#170) +- Add `cellToChildPos`, `childPosToCell`, and `cellToChildrenSize` functions. (#170) + ### Changed - Updated the core library to `v4.1.0` (#170) + ### Fixed - Patch libh3 bundles to check for `typeof document != "undefined"` before accessing `document`. This allows h3-js to be used in a Web Worker and React Native (#169) - Fix H3Index type hints for `cellToBoundary`, `cellArea`, `edgeLength` (#171) diff --git a/README.md b/README.md index ac8a53f..5da3bde 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,7 @@ const coordinates = h3.cellsToMultiPolygon(hexagons, true); * [.cellToBoundary(h3Index, [formatAsGeoJson])](#module_h3.cellToBoundary) ⇒ Array.<CoordPair> * [.cellToParent(h3Index, res)](#module_h3.cellToParent) ⇒ H3Index * [.cellToChildren(h3Index, res)](#module_h3.cellToChildren) ⇒ Array.<H3Index> + * [.cellToChildrenSize(h3Index, res)](#module_h3.cellToChildrenSize) ⇒ number * [.cellToCenterChild(h3Index, res)](#module_h3.cellToCenterChild) ⇒ H3Index * [.cellToChildPos(h3Index, parentRes)](#module_h3.cellToChildPos) ⇒ number * [.childPosToCell(childPos, h3Index, childRes)](#module_h3.childPosToCell) ⇒ H3Index @@ -391,6 +392,25 @@ Get the children/descendents of the given hexagon at a particular resolution | res | number | Resolution of hexagons to return | +* * * + + + +### h3.cellToChildrenSize(h3Index, res) ⇒ number +Get the number of children for a cell at a given resolution + +**Returns**: number - Number of children at res for the given cell +**Throws**: + +- H3Error If cell or parentRes are invalid + + +| Param | Type | Description | +| --- | --- | --- | +| h3Index | H3IndexInput | H3 index to get child count for | +| res | number | Child resolution | + + * * *