Skip to content

Recursive classify-and-descend H3 polyfill for single oversized features #125

Description

@cboettig

Follow-up to #98 (deferred from PR #123, which shipped the size-stratified "Plan A").

--resolution-by-area (#123) handles datasets where stratifying features into area tiers keeps every tier under the per-feature cell-array limit — it cleared all 136 k IUCN ranges. It does not help a single feature so large that even the coarsest tier's resolution still exceeds the 2 GB / ~268M-cell per-feature array limit (#107).

For that case, the #98 issue body describes the better long-term answer: recursive classify-and-descend — seed with coarse cells overlapping the polygon, then for each candidate test vs. the polygon: fully-inside → emit all target-res descendants via cellToChildren (cheap, streamable); fully-outside → drop; straddles → recurse to the next finer resolution. Geometry tests run only on the boundary band, so cost scales with perimeter, not area, and fine cells stream in bounded batches (fixing both the OOM and the page-size failure).

See the #98 body for the full algorithm, correctness argument (why naive coarse→cellToChildren→trim under-includes a ~coarse-cell-width perimeter band), cost drivers (prepared/indexed predicates on simplified geometry), and the antimeridian/polar/degenerate-ring sharp edges to cover in tests. Stress fixture: iucn-ranges-2025 marine ranges.

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