Files
lightcraft/crates/geocode
Andrew FrahnandClaude Opus 5.5 23e046daba Reverse geocoding: surface download failures, cache the gazetteer, e2e download test
- A failed, cancelled or finished place-names download is reported once
  as a toast (failures as an error toast that says what to do), and
  metadata.placeNamesStatus reports downloading / lastDownload / lastError.
- The parsed GeoNames data is cached in the session and re-read only when
  the cities file's size or modification time changes.
- End-to-end download test against a fake HTTP server on 127.0.0.1:
  a synthetic zip, a garbage zip, a truncated body and 404s.
- Info panel: Fill Location gets its own row (it was clipped beside
  Show on Map in a narrow panel).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-11 21:09:53 +11:00
..

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.