Part II — Products, companies and places · Chapter 7
Where the dollar store is closer than the supermarket
For 56% of populated tracts in the lower 48 the nearest dollar store is closer than the nearest listed supermarket chain (35% counting every grocery place), and the share in the poorest fifth of tracts is close to three times that in the richest.
On this page
- Origins, stores and the population summarized
- How complete the store lists are
- Income: the dollar store is closer in poorer tracts
- Density: the gap is widest in the countryside
- Metros: Detroit and Seattle sit at opposite ends
- Where the nearest supermarket is more than 10 miles away
- State by state
- Check your own state
- How the pipeline finds the nearest store
- Reusing the approach
For each census tract, which is closer: the nearest dollar store or the nearest supermarket? Dollar General, Dollar Tree and Family Dollar together run tens of thousands of small-format stores. This chapter measures the straight-line distance from every populated tract in the 48 contiguous states and DC to the nearest store of each kind, and asks how the answer changes with tract income and population density.
In 83,006 tracts, the nearest dollar store is closer than the nearest store of a listed supermarket chain in 56.4% of them, home to 54.1% of the population. That level depends on what counts as a supermarket. Counting every Overture grocery place as well, chain or not, the share falls to 34.6%. The income pattern does not depend on it: under both definitions the share is much lower in the richest fifth of tracts than in the poorest, from 73.1% to 27.4% with listed chains and from 43% to 15.7% with every grocery place. The rest of the chapter uses the listed chains; the share is highest in low-income rural tracts and lowest in high-income dense ones.
Against listed supermarket chains, the dollar store is closer across much of the South and Midwest, and seldom on the West Coast
Querychapters/07-store-access/pipeline/90_export.sqlShow SQL
CREATE OR REPLACE TABLE hex_r4 AS
SELECT h3_cell_to_parent(p.h3_r5, 4) AS cell, count(*) AS tracts,
median(a.ratio) AS median_ratio,
median(a.d_dollar_m) AS median_d_dollar_m, median(a.d_super_m) AS median_d_super_m
FROM acc a JOIN tract_pts p USING (geoid)
GROUP BY ALL;One compact GeoJSON FeatureCollection, written by COPY ... (FORMAT json)Runs at build time in DuckDB 2.0; shown for reading.Open file
Origins, stores and the population summarized
A store here is a place record that matches a chain in chains.csv: 3 dollar chains and 113 supermarket banners, Walmart Supercenters included. Corner groceries, independent supermarkets and warehouse clubs are not in the supermarket list, which matters for the result (see Caveats).
How complete the store lists are
Overture places come from many sources and are not a store register. The pipeline compares its counts per chain with each company's latest annual report:
| Dollar General Corp. | 20,942 | 2026-02-27 | 22,031 | 1.052 |
| Dollar Tree, Inc. | 9,000 | 2026-01-31 | 9,846 | 1.094 |
| 1959 Holdings (Dollar Tree until July 2025) | 7,622 | 2025-02-01 | 7,068 | 0.927 |
| Walmart Inc. | 4,260 | 2026-01-31 | 4,160 | 0.977 |
| The Kroger Co. | 2,697 | 2026-01-31 | 2,381 | 0.883 |
| Albertsons Companies | 2,244 | 2026-02-28 | 2,436 | 1.086 |
| Publix Super Markets | 1,432 | 2025-12-27 | 1,476 | 1.031 |
Dollar General's Overture count is 1.052 times its 10-K count. That is not an independent test: the 0.9 confidence bar for name-only records was chosen because lower bars overcounted Dollar General against the same 10-K. The state-by-state comparison and the other chains are independent of that choice. Family Dollar, counted from brand-tagged records only, is 0.927 times its last reported count, which dates from February 2025, before the chain was sold and closed stores. Walmart is compared with its Supercenters and Neighborhood Markets, at 0.977. checks.sql fails the run if any chain's ratio falls outside 0.85 to 1.15 (0.75 to 1.15 for Family Dollar, whose closures can only lower its true count), or if Dollar General's count is off by more than 25% in more than three of its 48 states.
The errors lean one way. Across the three dollar chains, Overture holds 3.7% more stores than reported; across the reported supermarket chains, it holds 1.7% fewer, with Kroger at 0.883. Extra dollar stores and missing supermarkets both push toward "dollar store closer", so the headline share is more likely too high than too low. Counting only brand-tagged records, which overcount less, still gives 57.9%.
Income: the dollar store is closer in poorer tracts
The poorer the tract, the more often the dollar store is the closer store
In the poorest twentieth of tracts, the dollar store is closer in 73.1%; in the richest twentieth, in 15.7%. Most of that gap is the dollar stores, not the supermarkets: the median distance to a supermarket is about the same at both ends (1,790 m and 1,870 m), while the median distance to a dollar store rises from 1,088 m to 3,660 m.
Density: the gap is widest in the countryside
Rural tracts are where the dollar store is most often closer
Splitting by both at once, the share falls with income in every density band. In low-income tracts with fewer than 50 people per km², the dollar store is closer in 87.9%; in high-income tracts with more than 2,000 people per km², in 21.3%. The density bands are set in 20_model.sql.
Within every density band, richer tracts are less likely to have the dollar store closer
| People per km² · Income quartile | Lowest income | Second | Third | Highest income |
|---|---|---|---|---|
| Under 50 | 87.9%n = 3,968 | 85.9%n = 5,344 | 78.5%n = 3,715 | 56.1%n = 1,109 |
| 50–500 | 77.3%n = 3,799 | 73.8%n = 4,365 | 65.2%n = 4,794 | 39.2%n = 5,371 |
| 500–2,000 | 73.1%n = 6,979 | 61.1%n = 6,052 | 47.6%n = 6,742 | 27.9%n = 8,654 |
| Over 2,000 | 58.8%n = 5,834 | 48.0%n = 4,819 | 38.6%n = 5,329 | 21.3%n = 5,445 |
Metros: Detroit and Seattle sit at opposite ends
The same comparison inside six metro areas
Share of tracts where the dollar store is closer, by metro
| Detroit | 71.5% |
|---|---|
| Houston | 62.0% |
| Chicago | 55.6% |
| Atlanta | 53.2% |
| Phoenix | 40.7% |
| Seattle | 19.2% |
In the Detroit metro the dollar store is closer for 71.5% of tracts; in Seattle, 19.2%. The median Seattle tract's nearest dollar store is 1.62 times as far as its nearest supermarket; in Detroit the ratio is 0.66.
Where the nearest supermarket is more than 10 miles away
5,657 tracts are more than 10 miles (16.1 km) from the nearest store of a listed supermarket chain. In 2,533 of them a dollar store is within 5 miles. Counting every grocery place, only 1,705 tracts are that far from one. Part of the difference is missing records rather than missing stores: in Elko County, Nevada, Overture holds the town's Walmart, Smith's and Albertsons only as pharmacy, garden-centre, fuel or money-transfer records, so no store record matches, and in White Pine County, Nevada, Overture lists grocery places but no listed chain. Those two counties hold most of the 23 tracts more than 150 km from a listed supermarket; with every grocery place counted, the farthest tract is 136.6 km away.
State by state
Mississippi has the highest share, 88.4%; among states, California and Washington have the lowest, 29.4% and 28.2%, and the District of Columbia is lower still at 15.5%.
| Mississippi | 873 | 88.4% | 2.5 | 6.1 |
| West Virginia | 546 | 84.2% | 2.9 | 5.8 |
| Arkansas | 822 | 80.0% | 2.8 | 4.9 |
| Alabama | 1,430 | 77.6% | 2.3 | 3.7 |
| Oklahoma | 1,202 | 77.2% | 1.9 | 3.0 |
| Louisiana | 1,367 | 76.9% | 1.8 | 2.7 |
| North Dakota | 228 | 76.8% | 3.8 | 12.4 |
| Kentucky | 1,301 | 76.4% | 2.4 | 4.1 |
| Indiana | 1,686 | 76.3% | 1.8 | 2.9 |
| South Dakota | 242 | 76.0% | 3.9 | 14.8 |
| Ohio | 3,155 | 75.7% | 1.6 | 2.5 |
| Michigan | 2,914 | 75.1% | 1.8 | 2.9 |
Check your own state
The dashboard below runs the chapter's tract table in your browser. The pipeline writes Parquet extracts to public storage: every tract with its population, income, density and distances to the nearest dollar store and listed supermarket (3 MB, sorted by state), every store used, and three small rollups by state, density and income that the panels read, about 80 KB together. DuckDB-Wasm reads them over HTTP range requests. Every panel shows its SQL. The Ask box at the bottom hands your question to an AI model that writes the SQL; the query runs here, on the same files, and the model only sees the small result. Its answers are live and unaudited, unlike the numbers above.
Live · runs in your browser
Nearest dollar store and supermarket, every US census tract
- Engine
- DuckDB 2.0.1 · Wasm
- Data read
- 0 B of 3.4 MB
The chapter's data sits in 5 Parquet files on public storage, 3.4 MB in all. Start the engine and DuckDB runs inside this page: each chart below is a SQL query that reads only the row groups and columns it needs over HTTP range requests.
tractsEvery tract: people, income, density, miles to each nearest storestoresEvery dollar store and listed supermarket: chain, state, locationcellsPeople by state, density band and national income tenthdistancePeople by state, density and quarter-mile distance to each store kindnearestPeople by state, density and banner of the nearest store
Queries this chapter's published snapshot; the data does not update in real time. No account, nothing uploaded.
How the pipeline finds the nearest store
The pipeline is six SQL files run in order against one DuckDB database file: five steps and a manifest writer. It downloads only what it needs from each source and keeps intermediate tables in out/.
Read the US slice of Overture places
Overture's places are one global set of 16 GeoParquet files. Each row carries a
bboxstruct, and a filter on it lets DuckDB skip row groups whose min/max statistics fall outside the US. The footers rule out all but 1,821 of 6,144 row groups, in 6 files, and DuckDB downloaded 2.97 GB of the 11.82 GB release. Column pruning saved less than it could: the columns the query names take 1.68 GB of those row groups, but over HTTP DuckDB fetched close to whole row groups.10_stage.sqlSQL COPY ( SELECT id, geometry, confidence, operating_status, name, brand, brand_wikidata, basic_category, category, region FROM (FROM places_in_box(-125.0, -66.8, 24.3, 49.5) -- contiguous states UNION ALL FROM places_in_box(-179.9, -129.9, 51.0, 71.6) -- Alaska UNION ALL FROM places_in_box(-160.6, -154.7, 18.8, 22.3)) -- Hawaii ) TO 'chapters/07-store-access/out/places_us_bbox.parquet' (FORMAT parquet, COMPRESSION zstd); -- places_in_box: WHERE p.bbox.xmin BETWEEN x0 AND x1 AND p.bbox.ymin BETWEEN y0 AND y120,398,256 placeschapters/07-store-access/pipeline/10_stage.sql
Match chains with one regular expression
Every chain pattern goes into one alternation, longest first, so "giant eagle" wins over "giant". A constant pattern is compiled once; joining each chain's pattern row by row was much slower. Records with a brand tag need a confidence of 0.5; records matched on their name alone need 0.9. Family Dollar counts brand-tagged records only, because its name-only records overcounted it against its last annual report.
10_stage.sqlSQL SET VARIABLE chain_re = ( SELECT '^(' || string_agg(alt, '|' ORDER BY length(alt) DESC, alt) || ')\b' FROM (SELECT DISTINCT unnest(string_split(pattern, '|')) AS alt FROM chains)); SELECT *, regexp_extract(lower(coalesce(brand, '')), getvariable('chain_re'), 1) AS m_brand, regexp_extract(lower(coalesce(name, '')), getvariable('chain_re'), 1) AS m_name FROM 'chapters/07-store-access/out/places_us_bbox.parquet';73,960 candidates; 2,164 duplicates droppedchapters/07-store-access/pipeline/10_stage.sql
Read TIGER tracts inside their zip files and place stores in tracts
ST_Readtakes a GDAL path, so/vsizip/reads a shapefile inside a zip without unpacking it, and/vsizip//vsicurl/does the same for a zip on a web server. On December 3, 2026, www2.census.gov answered DuckDB's HTTP client with HTTP 403 Forbidden while it still servedcurland GDAL.run.shtherefore downloads the Census files withcurlfirst, andcensus_zip()points at the local copies; settingCENSUS_ROOT=https://www2.census.govreads them in place where the server allows it.ST_Readneeds a constant path, so the 51 calls are built as one query string and run withquery(). A join onST_Containsis planned as a spatial join over an R-tree.10_stage.sqlSQL -- census_zip(path): '/vsizip/' plus the local copy, or '/vsizip//vsicurl/' plus the URL CREATE OR REPLACE MACRO tiger_tracts(fips) AS TABLE SELECT * FROM ST_Read(census_zip('/geo/tiger/TIGER2024/TRACT/tl_2024_' || fips || '_tract.zip')); CREATE OR REPLACE TABLE store_in_tract AS SELECT s.id, t.geoid, t.statefp FROM store_candidates s JOIN tracts t ON ST_Contains(t.geom, s.geom);84,415 tractschapters/07-store-access/pipeline/10_stage.sql
One point per tract
The centroid of a crescent-shaped tract can fall outside it. Where it does, the pipeline uses the Census internal point, which is always inside.
20_model.sqlSQL CASE WHEN ST_Contains(geom, centroid) THEN centroid::GEOMETRY ELSE ST_Point(intpt_lon, intpt_lat) END AS pt1,023 centroids fell outside their tractchapters/07-store-access/pipeline/20_model.sql
Nearest store of each kind, three ways
For each tract and each kind of store, find the store with the smallest
ST_Distance_Spheroid. An H3 prefilter looks only at stores in the ring of resolution-5 cells around the tract and widens the ring until the nearest candidate is provably the nearest store.20_model.sqlSQL SELECT t.geoid, t.kind, arg_min(s.id, ST_Distance_Spheroid(t.pt, s.geom)) AS id, min(ST_Distance_Spheroid(t.pt, s.geom)) AS dist_m FROM todo t CROSS JOIN unnest(h3_grid_disk(t.h3_r5, k)) AS ring(cell) JOIN targets s ON s.h3_r5 = ring.cell AND s.kind = t.kind GROUP BY ALL HAVING min(ST_Distance_Spheroid(t.pt, s.geom)) <= k * 0.5 * h3_get_hexagon_edge_length_avg(5, 'm');332,024 tract rows (4 store definitions) · 123 schapters/07-store-access/pipeline/20_model.sql
The three nearest-neighbour methods return identical distances for every Arkansas tract (checks.sql compares them). They differ in speed:
| Arkansas | ST_DWithin spatial join (R-tree) | 0.12 |
| Arkansas | H3 ring prefilter | 0.17 |
| Arkansas | NEAREST join (brute force) | 70.28 |
| national | ST_DWithin spatial join (R-tree) | 2.70 |
| national | H3 ring prefilter | 16.64 |
The brute-force NEAREST join took 70.28 s for Arkansas alone, which is why it runs only there, as the reference answer. The chapter's distances come from the H3 version, because it runs all four store definitions (see Caveats) in one pass; checks.sql requires the national R-tree answers to match it for every tract.
Reusing the approach
The nearest-neighbour step works for any "distance from each A to the closest B" question: clinics and counties, schools and bus stops. A spatial join on a radius, then arg_min over the matches, gives the exact nearest point as long as the radius is wide enough; widen it in steps for the rows that found nothing.
-- Nearest b for each a, exact: try a small radius, then retry the misses with a bigger one.
SELECT a.id, arg_min(b.id, ST_Distance_Spheroid(a.geom, b.geom)) AS nearest_b,
min(ST_Distance_Spheroid(a.geom, b.geom)) AS meters
FROM a JOIN b ON ST_DWithin(a.geom, b.geom, 0.05) -- degrees; planned as an R-tree spatial join
GROUP BY a.id;The radius is in degrees, so accept a match only if its distance in metres is smaller than the radius converted to metres at that latitude (20_model.sql shows the test).
# From the repository root, with the DuckDB 2.0.0 CLI on PATH
bash chapters/07-store-access/pipeline/run.shStaging, modelling and export took 6 minutes on a 16-core Windows 11 machine with two DuckDB threads. The nearest-neighbour search took 123 s, including the brute-force Arkansas join, and the Overture read 178 s. checks.sql and the manifest add a few more. Wall time, download sizes and open questions are in the pipeline README. The full pipeline, the chain list and the reference counts are in the pipeline folder.