Fixing MSHA Mines With No Coordinates or Positions in the Wrong Place

On this page

Problem statement

Plot MSHA's Mines file and half of it is missing: 44,299 of the 92,090 mines have no latitude or longitude. The gaps are not random. Almost every working mine has a position and almost every mine abandoned before 1980 does not, so a map of the file shows the present and erases the past, and a study of abandoned coal mines from it is a study of the recent ones. This page measures where the positions are missing, checks the positions that exist against their stated state, and falls back on the county code for the rest.

Quick answer

Count the missing positions, overall and by status:

miss = mines.LATITUDE.isna()
print(f"no coordinates: {miss.sum():,} of {len(mines):,} ({miss.mean():.1%})")
print(mines.groupby("CURRENT_MINE_STATUS").LATITUDE.apply(lambda s: s.isna().mean()).round(3).to_string())
no coordinates: 44,299 of 92,090 (48.1%)
CURRENT_MINE_STATUS
Abandoned               0.632
Abandoned and Sealed    0.002
Active                  0.001
Intermittent            0.009
New Mine                0.848
NonProducing            0.000
Temporarily Idled       0.003

44,299 mines, 48.1%, have no coordinates. Among working mines the gap is tiny, 0.1% of active and 0.9% of intermittent mines, and sealed and idle mines are almost complete too. 63.2% of abandoned mines have no position, and 84.8% of new mines, which are not yet fully described.

Horizontal bars of the share of mines with no coordinates by status: new mines 84.8% and abandoned mines 63.2%, every other status under 1%. Horizontal bars of the share of mines with no coordinates by status: new mines 84.8% and abandoned mines 63.2%, every other status under 1%.
Missing positions by status.

When positions began, wrong states and county fallback

1. Which abandoned mines lack a position

ab = mines[mines.CURRENT_MINE_STATUS == "Abandoned"]
yr = pd.to_datetime(ab.CURRENT_STATUS_DT, format="%m/%d/%Y").dt.year
print(ab.LATITUDE.isna().groupby(pd.cut(yr, [1900, 1980, 1990, 2000, 2010, 2027])).mean().round(3).to_string())
CURRENT_STATUS_DT
(1900, 1980]    0.987
(1980, 1990]    0.683
(1990, 2000]    0.673
(2000, 2010]    0.484
(2010, 2027]    0.167

The status date of an abandoned mine says when it closed, and the missing share falls steeply with it. 98.7% of mines abandoned by 1980 have no position, 68.3% of those abandoned in the 1980s and 67.3% in the 1990s, 48.4% in the 2000s and 16.7% since 2010. Positions were evidently recorded only for mines still working when MSHA began collecting them, so mines that closed earlier never got one.

2. Points outside their state

states = gpd.read_file("data/cb_2024_us_state_20m.zip")
g = gpd.GeoDataFrame(mines.dropna(subset=["LATITUDE"]), geometry=gpd.points_from_xy(mines.dropna(subset=["LATITUDE"]).LONGITUDE, mines.dropna(subset=["LATITUDE"]).LATITUDE), crs=4269).to_crs(states.crs)
j = gpd.sjoin(g, states[["STUSPS", "geometry"]], how="left", predicate="within")
j = j[~j.index.duplicated()]
print(f"inside the stated state: {(j.STUSPS == j.STATE).mean():.1%}; in another state: {((j.STUSPS != j.STATE) & j.STUSPS.notna()).sum():,}; in none: {j.STUSPS.isna().sum():,}")
inside the stated state: 95.9%; in another state: 1,135; in none: 807

Of the mines with coordinates, 95.9% fall inside the state they are registered in. 1,135 fall in another state and 807 outside every state outline. Before mapping, test each point against its stated state and treat the failures as missing.

Bars of abandoned mines without coordinates by when they closed: 98.7% by 1980, 68.3% in the 1980s, 67.3% in the 1990s, 48.4% in the 2000s and 16.7% since 2010. Bars of abandoned mines without coordinates by when they closed: 98.7% by 1980, 68.3% in the 1980s, 67.3% in the 1990s, 48.4% in the 2000s and 16.7% since 2010.
Abandoned mines without a position, by period of closure.

3. Fall back to the county

counties = gpd.read_file("data/cb_2024_us_county_20m.zip")
cent = counties.to_crs(5070).set_index("GEOID").representative_point().to_crs(4269)
st_fips = states.set_index("STUSPS").STATEFP
fill = mines[mines.LATITUDE.isna()].STATE.map(st_fips) + mines[mines.LATITUDE.isna()].FIPS_CNTY_CD
ok = fill.isin(cent.index)
print(f"missing positions with a county code that matches: {ok.mean():.1%} ({ok.sum():,})")
missing positions with a county code that matches: 98.7% (43,732)

Every mine has a county code, so a missing position can fall back to the county: with the state's FIPS code added, 98.7% of the missing positions, 43,732 mines, can be placed in their county. That is enough for county counts and choropleths, and too coarse for any distance or proximity analysis.

What a map of working mines loses

The data used on this page

The US Mine Safety and Health Administration's Open Government Data sets: the Mines file of every mine ever registered, annual employment and production by mine since 2000, and the accident reports from 2000 on (24 of their 57 columns, without the narratives), all as published on 23 October 2026, downloaded on 28 October 2026 and saved on this site, because MSHA replaces the files every week. Public domain. The files are pipe-delimited and Latin-1 encoded. County and state boundaries and county populations are the Census Bureau's 2024 files, public domain.

from pathlib import Path
import zipfile

import geopandas as gpd
import numpy as np
import pandas as pd
import requests

Path("data").mkdir(exist_ok=True)
# MSHA's Mines file, annual employment and production by mine since 2000 and accident reports since 2000 (24 columns,
# no narratives), all of 23 October 2026, with the Census Bureau's county estimates, counties and states. Saved
# 28 October 2026: MSHA replaces the files every week.
# Live: https://arlweb.msha.gov/OpenGovernmentData/DataSets/Mines.zip (and MinesProdYearly.zip, Accidents.zip)
ARCHIVE = "msha-mines-2026-10-28.zip"
if not Path(f"data/{ARCHIVE}").exists():
    Path(f"data/{ARCHIVE}").write_bytes(requests.get(f"https://data.spatialworkflow.io/{ARCHIVE}", timeout=900).content)
Z = zipfile.ZipFile(f"data/{ARCHIVE}")
for f in ["cb_2024_us_county_20m.zip", "cb_2024_us_state_20m.zip"]:
    Path(f"data/{f}").write_bytes(Z.read(f))
def read(name):
    return pd.read_csv(Z.open(name), sep="|", encoding="latin-1", dtype=str, low_memory=False)  # pipe-delimited, Latin-1, ids keep zeros
mines = read("Mines.txt")
for c in ["LATITUDE", "LONGITUDE", "NO_EMPLOYEES"]:
    mines[c] = pd.to_numeric(mines[c], errors="coerce")
print(f"MSHA Mines file: {len(mines):,} mines; {mines.CURRENT_MINE_STATUS.value_counts().head(3).to_dict()}")
MSHA Mines file: 92,090 mines; {'Abandoned': 69608, 'Abandoned and Sealed': 8823, 'Active': 6667}

Example 1: what a map of active mines loses

act = mines[mines.CURRENT_MINE_STATUS.isin(["Active", "Intermittent"])]
print(f"active or intermittent without coordinates: {act.LATITUDE.isna().sum():,} of {len(act):,}")
print(act[act.LATITUDE.isna()].PRIMARY_CANVASS.value_counts().to_dict())
active or intermittent without coordinates: 54 of 12,099
{'SandAndGravel': 40, 'Stone': 9, 'Nonmetal': 2}

A map of working mines loses almost nothing: 54 of the 12,099 have no coordinates, 40 of them sand and gravel pits, many portable plants. For the present the coordinates are complete; for the history of mining, only the county is.

Horizontal bars on a log scale: 45,849 mine positions inside their stated state, 1,135 in another state and 807 outside every state. Horizontal bars on a log scale: 45,849 mine positions inside their stated state, 1,135 in another state and 807 outside every state.
Mine positions against their stated state.