Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
cov/c3 ▾

Modern-Apps.git / scripts / networklocation / README.md

README.md2.5 KiBRenderedCodeRaw
1# networklocation — offline database build scripts
2
3The three databases `:networklocation` reads are built here. None of them ships in the APK:
4at 3.5 GB the old bundle pushed the MAOS factory zip past fastboot's 4 GiB limit, so they are
5published to `data.maproj.org` and downloaded to device-protected storage on request.
6
7| Database | Built by | Holds |
8| --- | --- | --- |
9| `geocoder.db` | [`geodb_build/`](geodb_build/) | Addresses, named streets, POIs and populated places, from an OSM planet dump |
10| `wifi-v3.wpsdb` | [`wps_harvest/`](wps_harvest/) | WiFi BSSID → coordinates + accuracy |
11| `cells-v3.wpsdb` | [`wps_harvest/`](wps_harvest/) | Cell tower → coordinates + accuracy |
12
13Both are self-contained Rust crates with their own READMEs; start there.
14
15## Rehearse before the planet
16
17Both builders scale from a metro extract to the planet, and both have surprises at scale that
18a small extract will not show you. Work up the ladder, recording time and peak memory at each
19rung, exactly as `scripts/maps/README.md` prescribes for the map layers:
20
21```
22SanFrancisco.osm.pbf 31 MB seconds
23california-latest 1.3 GB ~80 s, 9.0 M records, 70 MiB
24planet-latest 90 GB hours
25```
26
27## What replaced what
28
29The geocoder used to be built by `osmium tags-filter | osmium export` into a **101 GB**
30`addr.geojsonseq`, then packed by `scripts/geocoder_gen.cpp`. That needed osmium, g++, OpenMP,
31simdjson and POSIX `mmap` — WSL only — plus ~190 GB of free disk and a large-RAM box, and it
32indexed address points and nothing else. `geodb_build` reads the PBF natively through
33`scripts/maps/osm_ingest`, holds no intermediate, runs on Windows, and also carries streets,
34POIs and places.
35
36`scripts/geocoder_gen.cpp` is kept as the reference implementation of the v2 format. It is not
37part of any current pipeline.
38
39The beacon stores used to be built by `wtfps-experiment/store.py`, which lived outside the repo
40and no longer exists anywhere. `SUPPLY_CHAIN_RISKS.md` recorded that as the app's one
41unresolved-provenance dependency: the shipped stores were built by code nobody could read.
42`wps_harvest` is that code, in the tree.
43
44## Removed
45
46`gen.sh`, `run-extract.sh`, `poll.sh`, `gpoll.sh`, `reencode.sh` and `memest.py` drove the old
47JVM and C++ geocoder builds. They referenced `GeocoderGenerator` (a unit test that no longer
48exists) and `networklocation/tools/extract-osm-addresses.sh` (a file that no longer exists), so
49they could not run; and they hardcoded one machine's WSL paths. Recover them from git history
50if the v2 format ever needs rebuilding.