by crazygringo · 1y ago · 0 comments
In every sense, squares seem to be much easier to reason about and easier to hierarchically partition than hexagons are.
There are certain advantages to hexagons in certain contexts, like six degrees of movement instead of four in board games, but I don't see how any of those advantages translate here for geographical indexing.
I'd love to understand why hexagons as opposed to squares in this context are a superior solution rather than unnecessary complexity?
I get that you're saying hexes are almost always a better representation. I still don't see a concrete example of why, for geographical indexing specifically.
[Edit: sibling reply explained that at the end of the day, it's not about indexing but rather route planning.]
sometimes roads go diagonal
>The cell shape of that grid system is an important consideration. For simplicity, it should be a polygon that tiles regularly: the triangle, the square, or the hexagon. Of these, triangles and squares have neighbors with different distances. Triangles have three different distances, and squares have two different distances. For hexagons, all neighbors are equidistant
And
>This property allows for simpler analysis of movement. Hexagons have the property of expanding rings of neighbors approximating circles
>Hexagons are also optimally space-filling. On average, a polygon may be filled with hexagon tiles with a smaller margin of error than would be present with square tiles.
Hierarchical partitioning with exact containment is useful when aggregating but that's not always the most critical property.
One of the use case Uber was trying to solve here, was to show which regions had surge pricing - on the uber app for the drivers. With h3 and hexagons you can argue it looks a teensy bit better with smoother gradients https://h3geo.org/docs/comparisons/s2.
I am not sure whether Uber uses h3 for other use cases like - finding the closest drivers next to a location.
See this presentation from Uber on this: https://www.youtube.com/watch?v=ay2uwtRO3QE
[1] https://github.com/Filimoa/polars-h3
[2] https://drive.google.com/file/d/18jIVEbE_1QbwTbHdMqj0AVqguf2...
From there you're just trying to optimize uniformity in distance to neighbors, how big the adjustments to the irregular polygons need to be to get them to tile on the surface are, how easy the polygon is to split up into smaller similarly shaped variants of itself as sub tiles, and trying to be somewhat close to a circle in shape as that means the average distance to the center of the area defined by the index is as close to as it can be.
If you chunk through those you'll find quadrangles aren't attractively simple anymore and hexagons tend to optimize the parameters very well. H3 actually uses both hexagons and the occasional pentagon (12 total, no matter the zoom level). It all comes down to "tiling isn't going to be perfect - what is the most optimal answer for the purpose of the tiling".
While squares have superior properties for analytical geospatial data processing that H3 doesn't have, such as congruency, they really only work for Euclidean spaces and the surface of a 2-sphere is non-Euclidean. Any system using squares will be a poor approximation of "equal area" relative to hexagons, which makes them poor for visualization. To use squares for indexing, you need an extra step that allows non-Euclidean space to be addressable from Euclidean space. There are two main ways of doing this.
First, one can project the surface of the sphere onto the surface of a Euclidean cube. Second, one can use an embedding, indexing the 2-sphere in Euclidean 3-space. Both of these can be trivially projected to a hexagonal system like H3 for visualization purposes and commonly are.
If you primarily need visualization and your data is small, using H3 eliminates the step where you need to figure out how to map non-Euclidean data models to Euclidean data models. If you are doing large-scale geospatial processing, it becomes worth the effort for both scalability and performance reasons.
Has Uber figured out a way to do it with just hexagons?