Files
976f52ab69 geocode: use craft-zip for GeoNames downloads (#4566)
* T006: read GeoNames ZIPs with craft-zip

* geocode: take craft-zip at the workspace's craft-libs rev; build the fixture with its writer

craft-zip at 23acc704, the rev every other craft-libs crate here uses, has
the same Archive and Writer code as 5c496f6e (that rev only adds the
seekable reader), so the workspace stays on one craft-libs rev.

unzip::make now builds its one-file fixture with craft_zip::Writer instead
of hand-written headers, so geocode no longer needs crc32fast or
miniz_oxide.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* geocode: retain the selected ZIP entry index

---------

Co-authored-by: FredApps <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-19 21:31:08 -05: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.