Files
lightcraft/crates/geocode/README.md
T
Andrew FrahnandClaude Opus 5.5 b28b05c475 Reverse geocoding: fill City / State / Country from GPS (offline GeoNames)
New crate lightcraft-geocode (L1): parses the GeoNames cities dump and finds the
nearest place within 50 km through a 1-degree cell index; NaN / out-of-range
positions and malformed lines find nothing. Engine commands
metadata.reverseGeocode (Photo menu, Info panel "Fill Location"; fills only
empty fields unless overwrite, one undo step, activity row for batches),
metadata.downloadPlaceNames (background download of the CC-BY 4.0 GeoNames
files into the settings folder, cancellable activity row) and
metadata.placeNamesStatus. No data is bundled; NOTICE records the licence.

Fixes #582.

Sources: GeoNames dump readme (prose); haversine (textbook); PKWARE APPNOTE
(ZIP, prose); cell index own design.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-11 20:49:36 +11:00

18 lines
1.1 KiB
Markdown

# lightcraft-geocode (L1)
Offline reverse geocoding: a GPS position becomes Sublocation / City / State / Country.
- **Data:** the GeoNames dump (<https://download.geonames.org/export/dump/>), licensed CC-BY 4.0
(attribution: "GeoNames, geonames.org"). Nothing is bundled: the engine
(`metadata.downloadPlaceNames`) downloads `cities15000.zip`, `admin1CodesASCII.txt` and
`countryInfo.txt` on the user's request into the settings folder. This crate only parses and
searches; it never touches the network.
- **Lookup:** the nearest populated place within `MAX_KM` (great-circle distance), searched in the
1° cells around the position, so one lookup looks at a few dozen places, not all of them.
- **unzip:** just enough ZIP to read one file out of `cities15000.zip` (stored or deflated).
- **Never panics on hostile input:** bad lines are skipped, NaN / out-of-range positions find
nothing, sizes and counts are capped.
Sources: GeoNames dump readme (file layout, prose); haversine distance (textbook); PKWARE APPNOTE
(ZIP, prose spec); the cell index is own design.