mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-25 10:37:11 -06:00
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>
1.1 KiB
1.1 KiB
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.