Here’s a map I generated with some random addresses using claude code. I had claude create a fiber_map.py python script and play it against a random assortment of addresses from Open Street Map in the 19606 zip code. It only got so far until the reCaptcha started scoring me as a bot. But anyway was a fun interesting little script.

#!/usr/bin/env python3
"""
Build a map of addresses in a ZIP code and mark which ones have fiber.
Step 1 - fetch: pull addresses (with lat/lon) for a ZIP from OpenStreetMap.
python fiber_map.py fetch --zip 19606 --out addresses.csv
Step 2 - fill in the `available` column of addresses.csv
(yes / no / blank = unknown). See the notes in the chat for sources.
Step 3 - map: draw the OpenStreetMap-based map.
python fiber_map.py map --csv addresses.csv --out fiber_map.html
python fiber_map.py map --csv addresses.csv --only-available
Requires: pip install folium requests
"""
import argparse
import csv
import sys
import requests
OVERPASS_URL = "https://overpass-api.de/api/interpreter"
# south, west, north, east - a generous box around Reading, PA 19606.
# Results are still filtered by the addr:postcode tag.
DEFAULT_BBOX = "40.24,-76.00,40.36,-75.80"
USER_AGENT = "fiber-map-script/1.0 (personal use)"
def fetch(args):
zip_filter = "" if args.no_zip_filter else f'["addr:postcode"="{args.zip}"]'
query = f"""
[out:json][timeout:180];
(
node["addr:housenumber"]["addr:street"]{zip_filter}({args.bbox});
way["addr:housenumber"]["addr:street"]{zip_filter}({args.bbox});
);
out center tags;
"""
print("Querying Overpass (can take up to a minute)...", file=sys.stderr)
resp = requests.post(
OVERPASS_URL,
data={"data": query},
headers={"User-Agent": USER_AGENT},
timeout=240,
)
resp.raise_for_status()
elements = resp.json().get("elements", [])
rows, seen = [], set()
for el in elements:
tags = el.get("tags", {})
lat = el.get("lat") or el.get("center", {}).get("lat")
lon = el.get("lon") or el.get("center", {}).get("lon")
if lat is None or lon is None:
continue
number = tags.get("addr:housenumber", "").strip()
street = tags.get("addr:street", "").strip()
unit = tags.get("addr:unit", "").strip()
city = tags.get("addr:city", args.city).strip()
postcode = tags.get("addr:postcode", args.zip).strip()
line1 = f"{number} {street}" + (f" #{unit}" if unit else "")
address = f"{line1}, {city}, PA {postcode}"
if address in seen:
continue
seen.add(address)
rows.append({"address": address, "lat": lat, "lon": lon, "available": ""})
rows.sort(key=lambda r: r["address"])
with open(args.out, "w", newline="", encoding="utf-8") as f:
w = csv.DictWriter(f, fieldnames=["address", "lat", "lon", "available"])
w.writeheader()
w.writerows(rows)
print(f"Wrote {len(rows)} addresses to {args.out}", file=sys.stderr)
if not rows:
print(
"No results. OSM postcode tagging can be patchy - try --no-zip-filter "
"or a different --bbox.",
file=sys.stderr,
)
def build_map(args):
import folium # imported here so `fetch` works without folium installed
with open(args.csv, newline="", encoding="utf-8") as f:
rows = list(csv.DictReader(f))
if not rows:
sys.exit("CSV is empty.")
yes = {"yes", "y", "true", "1", "fiber"}
no = {"no", "n", "false", "0"}
m = folium.Map(
location=[
sum(float(r["lat"]) for r in rows) / len(rows),
sum(float(r["lon"]) for r in rows) / len(rows),
],
zoom_start=15,
tiles=args.tile_url or args.tiles,
attr=(args.attr or "Map tiles, data (c) OpenStreetMap contributors") if args.tile_url else None,
)
counts = {"yes": 0, "no": 0, "unknown": 0}
styled = []
for r in rows:
val = (r.get("available") or "").strip().lower()
if val in yes:
status, color, radius, order = "yes", "#00c800", 9, 2
elif val in no:
status, color, radius, order = "no", "#e60000", 7, 1
else:
status, color, radius, order = "unknown", "#6b6b6b", 5, 0
counts[status] += 1
if args.only_available and status != "yes":
continue
styled.append((order, status, color, radius, r))
# draw gray first, then red, then green, so colored dots sit on top
for order, status, color, radius, r in sorted(styled, key=lambda t: t[0]):
folium.CircleMarker(
location=[float(r["lat"]), float(r["lon"])],
radius=radius * args.size,
color="white",
fill=True,
fill_color=color,
fill_opacity=1.0,
weight=2,
tooltip=r["address"],
popup=f'{r["address"]}<br>Fiber: {status}',
).add_to(m)
legend = f"""
<div style="position: fixed; bottom: 24px; left: 24px; z-index: 9999;
background: white; padding: 8px 12px; border: 1px solid #888;
border-radius: 6px; font: 13px sans-serif;">
<span style="color:#00c800">●</span> Fiber available ({counts['yes']})<br>
<span style="color:#e60000">●</span> Not available ({counts['no']})<br>
<span style="color:#6b6b6b">●</span> Unchecked ({counts['unknown']})
</div>"""
m.get_root().html.add_child(folium.Element(legend))
m.save(args.out)
print(f"Saved {args.out} {counts}", file=sys.stderr)
def main():
p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
sub = p.add_subparsers(dest="cmd", required=True)
f = sub.add_parser("fetch", help="download addresses for a ZIP from OpenStreetMap")
f.add_argument("--zip", default="19606")
f.add_argument("--city", default="Reading", help="fallback city if OSM has none")
f.add_argument("--bbox", default=DEFAULT_BBOX, help="south,west,north,east")
f.add_argument("--no-zip-filter", action="store_true", help="keep every address in the bbox")
f.add_argument("--out", default="addresses.csv")
f.set_defaults(func=fetch)
m = sub.add_parser("map", help="draw the map from a CSV")
m.add_argument("--csv", default="addresses.csv")
m.add_argument("--out", default="fiber_map.html")
m.add_argument("--only-available", action="store_true", help="show only green dots")
m.add_argument("--tiles", default="CartoDB positron",
help='base map: "CartoDB positron", "CartoDB voyager", or "OpenStreetMap" '
"(OSM tiles are blocked when opening the HTML as a local file)")
m.add_argument("--size", type=float, default=1.0,
help="dot size multiplier, e.g. 1.5 or 2 (default 1.0)")
m.add_argument("--tile-url", help="custom tile URL with your API key, e.g. "
"https://api.maptiler.com/maps/streets-v2/{z}/{x}/{y}.png?key=YOUR_KEY")
m.add_argument("--attr", help="attribution text required by your tile provider")
m.set_defaults(func=build_map)
args = p.parse_args()
args.func(args)
if __name__ == "__main__":
main()
Requires python and modules folium and requests
pip install folium requests
In one window run
python -m http.server 8000
In another window generate the map
python fiber_map.py map --tiles OpenStreetMap --size 1.5
Note this assumes an addresses.csv file exists in the same folder as the script. This must have these 4 columns
address, lat, lon, available.
Available will be yes, no or blank (Unchecked)
You’ll have to get your own addresses.csv and to populate the yes,no you need to check by hand or write some kind of bot busting web parser.
How the script works
python fiber_map.py fetch –zip 19606 pulls addresses and coordinates from OpenStreetMap and writes addresses.csv. It has an available column that starts blank. If OSM’s postcode tagging is patchy and you get few results, add –no-zip-filter or widen –bbox.
You fill in the available column with yes/no, or leave it blank for unknown.
python fiber_map.py map writes fiber_map.html, an OpenStreetMap map with green dots for yes, red for no, gray for unchecked, plus a legend and address tooltips. Add –only-available to show just the green ones.