Skip to content

v0.8.1

Choose a tag to compare

@cboettig cboettig released this 28 Sep 18:16
· 90 commits to main since this release
198b0ec

A single correctness fix: line datasets were missing some of the H3 cells their lines pass through, and more of them the farther from the equator. Polygon and point hexing are unchanged.

This is the only change since v0.8.0 (#240).


Line hex no longer drops cells the line passes through (#239)

The old method buffered each line by one average H3 edge length in degrees, then kept only the cells whose center fell inside that buffer. That drops cells in two ways:

  • Latitude. A degree of longitude is only cos(lat) × 111 km. East–west, the buffer shrank with latitude: to half an edge at 60°.
  • Cell size. H3 cells vary about 2× in size across the globe. Even at the equator, cells larger than average fell outside a buffer one average edge wide.

Measured on a 4.0M-segment global coastline build at res 8, as the share of segment start-point cells missing from that segment's hex rows:

abs lat 0–15° 15–30° 30–45° 45–60° 60–75° 75–90°
missing 0.5% 1.3% 5.5% 14.4% 16.9% 11.9%

Now, each line is given a ~1 cm buffer, only so that it becomes a polygon. That sliver is filled with H3's overlap containment, which keeps every cell the polygon touches. The result is exactly the cells the line intersects, at any latitude and for any cell size, on both the fixed-resolution and --resolution-by-area paths.

In a sweep of random lines at res 8:

lat cells the lines cross missed before missed now
0° 587 3 0
45° 586 73 0
60° 593 131 0
75° 582 221 0
85° 596 289 0

The cells for each line also change in the other direction: the old buffer sometimes added neighboring cells whose centers were within an edge of the line but that the line never crossed, and those are gone. Line hexing costs about 1.35× as much in the polyfill step.

Who should rebuild

Every dataset with LINESTRING / MULTILINESTRING geometry hexed before 0.8.1. Data built with 0.8.0 carries cng_datasets_version in its parquet key-value metadata:

SELECT key, value FROM parquet_kv_metadata('…/h0=*/data_0.parquet') WHERE key = 'cng_datasets_version';

A dataset with no stamp predates 0.8.0.

Known issue, not fixed in this release

Features that cross the antimeridian (±180°), including single-part lines that jump across it, are still filled the long way round the globe (#241). The fix is in #242.