Gallery
Chain footprints on a hex grid
Where the 12 US storefront chains with the most places in Overture are, counted into H3 cells straight from Overture's S3 parquet.
Dollar General has more US places than any other storefront chain in Overture
The ranking rule: Overture places per exact brand string, with confidence of at least 0.5, not marked permanently closed, inside the 50 states and DC. Dollar General leads with 19,642 places, then Subway with 14,418. Dollar General's 10-K reports 20,942 US stores, so Overture's count is 93.8% of that; for Dollar Tree it is about 100%, against a 10-K figure rounded to 9,000. Only storefronts are ranked. Four brands with more places than the 12th chain are left out: Western Union (34,928, agent counters inside other businesses), Amazon Locker (parcel lockers), Citibank (its most common category is atm) and Coinme (cryptocurrency kiosks). H&R Block's tax offices and State Farm's agent offices stay in. A brand that Overture tags inconsistently (spelling, sub-brands) loses places that are really there. Alaska and Hawaii count toward the totals but are left off the map so one frame fits the lower 48.
Read the US slice of Overture, then bin the 12 chains into H3 cellsgallery/g03-chain-footprints/pipeline.sqlShow SQL
CREATE SECRET overture (TYPE s3, KEY_ID '', SECRET '', REGION 'us-west-2',
SCOPE 's3://overturemaps-us-west-2');
-- One scan per box: bbox ranges are checked against row-group statistics.
CREATE MACRO places_in_box(x0, x1, y0, y1) AS TABLE
SELECT * FROM overture_places p
WHERE p.lon BETWEEN x0 AND x1 AND p.lat BETWEEN y0 AND y1;
COPY (SELECT * FROM (FROM places_in_box(-125.0, -66.8, 24.3, 49.5)
UNION ALL FROM places_in_box(-179.9, -129.9, 51.0, 71.6)
UNION ALL FROM places_in_box(-160.6, -154.7, 18.8, 22.3))
WHERE brand IS NOT NULL) TO 'out/branded_us_bbox.parquet';
-- Count each brand's places per resolution-4 cell, then one column per brand.
CREATE TABLE hex AS
SELECT c.rank, h3_latlng_to_cell(p.lat, p.lon, 4) AS cell, count(*) AS locations
FROM points p JOIN chains c USING (brand)
WHERE p.statefp NOT IN ('02', '15') GROUP BY ALL;
PIVOT (SELECT h3_h3_to_string(cell) AS h3, 'r' || rank AS r, locations FROM hex)
ON r IN ('r1', 'r2', 'r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9', 'r10', 'r11', 'r12')
USING coalesce(sum(locations), 0)::INT GROUP BY h3;2.29 GB fetched from S3 in 1,986 requests · 1,788,818 branded places in the US boxes · 3,175 cells · 99 sRuns at build time in DuckDB 2.0; shown for reading.Open file
Places are points, so the pipeline reads bbox.xmin and bbox.ymin as the location and never downloads the geometry column. The anonymous secret with empty keys and the one-scan-per-box UNION ALL are the access pattern from Chapter 7, where an OR of the three boxes in one scan skipped no row groups. Cell boundaries come from the community h3 extension and are written as GeoJSON with coordinates rounded to two decimals.
duckdb -bail :memory: -c ".read gallery/g03-chain-footprints/pipeline.sql"Full pipeline: gallery/g03-chain-footprints/pipeline.sql.