Skip to content

Cell stats tables and hard-coded values - #529

Merged
ajfriend merged 17 commits into
uber:masterfrom
ajfriend:area_table
Dec 1, 2021
Merged

ajfriend merged 17 commits into
uber:masterfrom
ajfriend:area_table

Conversation

@ajfriend

@ajfriend ajfriend commented Oct 30, 2021 •

Copy link
Copy Markdown
Contributor

@ajfriend
ajfriend marked this pull request as draft October 30, 2021 21:46
@ajfriend ajfriend changed the title Cell stats tables and hard-coded values [WIP] Cell stats tables and hard-coded values Oct 30, 2021
@coveralls

coveralls commented Oct 30, 2021 •

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 98.2% when pulling 180aada on ajfriend:area_table into b501c53 on uber:master.

Comment thread src/h3lib/lib/latLng.c Resolved
Comment thread website/docs/library/restable.md Resolved
@ajfriend
ajfriend marked this pull request as ready for review November 27, 2021 04:49
@ajfriend ajfriend changed the title [WIP] Cell stats tables and hard-coded values Cell stats tables and hard-coded values Nov 27, 2021

@dfellis dfellis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work @ajfriend ! :)

@nrabinowitz nrabinowitz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few small notes, but this looks great! Thanks for taking this on.

Comment thread src/h3lib/include/h3api.h.in Resolved
| 14 | 0.000006267 | 0.000003162 | 0.5046 |
| 15 | 0.000000895 | 0.000000452 | 0.5046 |

*: Within a given resolution, all pentagons have the same area.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure you need to restate this - I'd keep either here or above but doubt you need both.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see much cost to keeping both; it's only one line. And I don't see a quicker, cleaner way to explain the difference in table headers where hexagons get "Average" but pentagons don't (that also catches the use case of users jumping directly to the table they care about and ignoring everything else).

For the purpose of getting this diff landed, I'll keep it as is, but I also wouldn't mind if anyone put up an alternative proposal. :)

| 14 | 6.267 | 3.162 |
| 15 | 0.895 | 0.452 |

*: Within a given resolution, all pentagons have the same area.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you really need to say that again? ;)

[WGS84](https://en.wikipedia.org/wiki/WGS84)/[EPSG:4326](https://epsg.io/4326).
:::

TODO

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to keep the TODOs here, or leave/comment the sections out? This seems a little odd in published docs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm only changing the 4.0 docs in this diff, which aren't the ones surfaced to users by default. In that sense, I'm considering the 4.0 docs a work in progress, so I'm not too bothered by obvious TODO sections that'll hopefully remind us to fill those out before finalizing the 4.0 docs.

@ajfriend
ajfriend merged commit 76bbde1 into uber:master Dec 1, 2021
@ajfriend
ajfriend deleted the area_table branch December 1, 2021 04:27
alexey-milovidov added a commit to ClickHouse/ClickHouse that referenced this pull request Mar 22, 2026
The H3 C library fork (github.com/ClickHouse/h3) was on v3.7.1 with
2 ClickHouse-specific range-check patches. Upstream H3 v4 already
includes equivalent validation in `_h3ToFaceIjk`, so the patches are
no longer needed.

Created a clean `clickhouse-v4` branch in the fork at upstream tag
v4.4.1 with no additional patches.

This fixes two known bugs in the v3 lookup tables:
- Average hexagon edge lengths were actually inradii (apothems), not
  edge lengths (uber/h3#201, fixed in
  uber/h3#749)
- Average hexagon areas naively divided Earth surface by total cell
  count without excluding pentagon areas (fixed in
  uber/h3#529)

The v4 API changed most functions to return `H3Error` with results via
output parameters. Updated all 27 wrapper files in `src/Functions/` to
use the new calling convention. Also updated function renames:
`exactEdgeLengthM` → `edgeLengthM`, `distanceM` →
`greatCircleDistanceM`, etc.

Updated 11 test reference files to reflect the corrected values.

Reference: #100272

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
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.

5 participants