Skip to content

feat: Add cellToChildren(parent, resolution)#18

Merged
donmccurdy merged 3 commits intomasterfrom
feat/cellToChildren
Jan 22, 2025
Merged

feat: Add cellToChildren(parent, resolution)#18
donmccurdy merged 3 commits intomasterfrom
feat/cellToChildren

Conversation

@donmccurdy
Copy link
Copy Markdown
Contributor

Adds a new utility function, which returns a list of all child cells at a given resolution within a parent cell.

Usage:

const parent = 5224972163924099071n; // res=8
const cells = cellToChildren(parent, 9);
// → 5229475712011862015n, 5229475729191731199n, 5229475746371600383n, 5229475763551469567n

Note that geometryToCells(cellToBoundary(parent), resolution) will not give the same result, as the conversion to/from a polygon may pick up extra cells at the boundaries due to floating point precision.

@donmccurdy
Copy link
Copy Markdown
Contributor Author

CI should pass for this PR after #17.

@donmccurdy donmccurdy merged commit cdbf057 into master Jan 22, 2025
@donmccurdy donmccurdy deleted the feat/cellToChildren branch January 22, 2025 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants