mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-24 01:57:40 -06:00
Found while testing crates/geocode/src/lib.rs:105-108 (cell) vs lib.rs:189-192 (reverse) Co-authored-by: Claude Haiku 5.5 <noreply@anthropic.com>
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) downloadscities15000.zip,admin1CodesASCII.txtandcountryInfo.txton 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.