h3 icon indicating copy to clipboard operation
h3 copied to clipboard

Hex area and edge length don't mathematically add up

Open wwchen opened this issue 5 years ago • 9 comments

According to official docs on Cell Areas for H3 Resolutions

Using the provided edge length to calculate area with the equation (3 * sqrt(3)) / 2 * (edge ^2), the answer is 33% smaller than the provided area.

Full analysis is here https://docs.google.com/spreadsheets/d/1O6_IZ9-WLCvf_1DgXeMrARowWLYwetlKd51DOvRtaaA/edit?usp=sharing

I strongly believe there has been a miscalculation with the provided documentation and in the library

wwchen avatar Mar 01 '19 01:03 wwchen

It looks like you're calculating the area using the formula for a hexagon on a plane. But H3 cells are spherical polygons, so that formula does not apply.

sahrk avatar Mar 20 '19 16:03 sahrk

@sahrk are you contending that spherical polygons are 33% larger in area at say resolution 15?

mlyons-tcc avatar Aug 19 '19 20:08 mlyons-tcc

@mlyons-tcc I am contending that the formula you give above is the formula for the area of a planar hexagon, and that a spherical polygon will always have a larger area than a planar polygon with the same edge length. Off-hand I don't know what the difference is, but 33% wouldn't surprise me.

sahrk avatar Aug 19 '19 20:08 sahrk

@sahrk It would be surprising to me if the spherical area is 33% larger than the planar area at both ~1 sq. m resolution and at ~4.25E12 sq. m resolution.

A spherical polygon's additional area is related to the spherical excess. This is outside my areas of expertise, but my understanding is that the excess approaches 0 at significantly small areas relative to the sphere therefore approaching the planar area.

Since the sheet provided shows a fixed difference of 33% at all resolutions from calculated planar area to the reported hexagon area, it simply cannot be correct if my above statement is true. Even though the formula used to describe the problem is on the plane, it would well enough proves the reported issue since it evaluates across different resolutions.

From what I can tell, the average hexagon area reported by H3 is also poor. See https://github.com/uber/h3/issues/168#issuecomment-523063844

mlyons-tcc avatar Aug 20 '19 15:08 mlyons-tcc

@mlyons-tcc The "average hexagon area" is just the surface area of the earth divided by the number of hexagons at each resolution (adjusted for the 12 pentagons). It has no relationship to the "average hexagon edge length"; I do not believe I created that column in the table and do not know what that means. I do have some concerns about observations made in other parts of these area discussions that curiosity will drive me to look into at some point, though free time is hard to come by...

sahrk avatar Aug 21 '19 03:08 sahrk

The numbers calculate correctly if you use the "edge" as the radius. The table heading contains an error. It should read "Average Hexagon Radius Length (km)" instead of "Average Hexagon Edge Length (km)"

KeithFolkerts avatar Feb 07 '20 00:02 KeithFolkerts

Isn't the edge and circumradius the same thing for a regular hexagon? Or are you saying it's the inradius?

mlyons-tcc avatar Feb 07 '20 16:02 mlyons-tcc

@KeithFolkerts I did a quick calculation and found the 33.3% discrepancy could be explained if those values are in fact the inradius. Thanks for the insight!

mlyons-tcc avatar Feb 07 '20 16:02 mlyons-tcc

Just today arrived to the same confusion: what does the "average edge length" actually means? An average tangent? @mlyons-tcc your comment agrees with my opinion.

vojtech-filipec avatar Mar 23 '21 21:03 vojtech-filipec