Spatial-first geocoding in one Rust binary.
Sub-25 ms forward, address verification, reverse, and batch geocoding over memory-mapped SQLite shards and S2 geometry. 427M+ rooftops and 18.5M cadastral parcels across 128 global shards — self-host on one NVMe VPS, run inside DuckDB, embed on iOS/Android, or run 100% offline in the browser via WebAssembly with zero per-request fees.
Querying live engine...
Spatial-first architecture
Parse-first geocoders (libpostal, Pelias, Nominatim) label tokens into fields before checking geography, so swapped fields or a wrong city misroute queries. texspace intersects S2 spatial footprints first.
query → normalize text, extract sub-premise / PO box, fast-path WGS84 coords & Plus Codes → router.db: RoaringBitmap postings narrow 128 global shards to 1–2 shards (<0.4 ms) → per-shard subsequence mapping + in-RAM S2 CellUnion galloping intersection → 4-tier lookup: parcel polygon → rooftop → building-snapped → street interpolation → compiled depth-3 GBDT ranker + Platt confidence calibration + conflict diagnostics
S2 CellUnion joins
Entities and attributes are indexed as S2 cell coverings in SQLite WITHOUT ROWID tables with Hilbert-ordered keys. Intersecting spans in RAM verifies physical co-location before scoring.
Mmap SQLite + zero-downtime reload
Shards are immutable read-only mmap files (core.db, optional buildings.db and parcels.db). --osm-sync minute streams official OSM diffs into osm_delta.db, and SIGHUP / file-watch hot-reloads updated shards after texspace update with zero downtime.
Deterministic romanization & verification
Chinese Pinyin, Japanese Hepburn Kana, Korean Hangul, Cyrillic, Greek, Hebrew, Arabic, and Thai transliterate offline, while /v1/verify and checkout /v1/autocomplete return deliverability grades, postal lines, structured components, correction flags, and highlight spans.
Origin-IP proximity, GeoIP & Timezone
Sibling geoip.db (DB-IP City Lite + IPtoASN) and 16 MB tz.db (444 IANA zones + RFC 8536 TZif v2/v3 rules) sort ambiguous queries by caller IP proximity by default (configurable via --no-ip-focus or focus.ip=off|<ip>) and evaluate DST/local times offline.
Benchmarks & resource footprint
Measured on a strictly independent 440-query, 9-country civic holdout sourced exclusively from municipal and national open-data portals (zero Overture, OSM, OpenAddresses, or GeoNames sampling; report & scripts).
| Provider | Top-1 | Top-3 | Median err | ≤10 m | ECE ↓ | p50 latency | vs texspace (McNemar) |
|---|---|---|---|---|---|---|---|
| texspace ($0, offline) | 96.6% | 12.7 m | 0.033 | 24.2 ms | baseline (#1) | ||
| ArcGIS ($40–$500/1M) | 96.8% | 12.0 m | 0.040 | 269.2 ms | +0.2 pp (tie) | ||
| Google Maps ($5,000/1M) | 93.9% | 20.9 m | 0.078 | 170.7 ms | +1.6 pp (15 vs 8) | ||
| Mapbox v6 ($750–$5k/1M) | 90.0% | 19.6 m | 0.262 | 206.0 ms | +7.7 pp (p < 1e-6) | ||
| Geocode Earth ($500/1M) | 77.0% | 23.4 m | 0.143 | 258.2 ms | +18.6 pp (p < 1e-18) | ||
| Photon (OSM) | 66.6% | 27.1 m | — | 813.5 ms | +32.0 pp (p < 1e-35) |
texspace scores 76.0% GH6 on Paper Table 4 (76.39% full 10k Gold, 95.21% GH4, 38.4 m median), outperforming OpenCage (68.2%), Pelias (67.8%), Photon (62.8%), and Nominatim (55.6%) — and beating Pelias by +11.1 pp on Gold high-divergence (full report).Tradeoffs: Commercial APIs retain deeper long-tail business/POI catalogs, and rooftop density tracks upstream open address and OSM coverage per country. All evaluation queries and scoring scripts live in
eval/.
| Engine | Planet RAM | Planet Disk | Setup | Runtime stack |
|---|---|---|---|---|
| texspace | 4–16 GB (65 MB idle heap) | ~100 GiB NVMe | ~15 min pull | 1 static Rust binary + mmap SQLite |
| Nominatim | 64–128 GB | 900 GB–1 TB | 24–72 hrs | PostgreSQL + PostGIS |
| Pelias | 64–128 GB | 300+ GB | 18–48 hrs | Elasticsearch + Node + libpostal |
| Photon | 32–64 GB | 120–180 GB | 1–3 hrs | JVM + OpenSearch |
Smaller footprints: 1 state/metro shard runs in 256 MB RAM · iOS/Android FFI library is 4.5 MB (~10 MB peak dirty RAM).
Interfaces
One engine across CLI, Pelias-compatible HTTP endpoints (plus /v1/verify, /v1/geoip, /v1/timezone, and /openapi.json), Rust crate, Python wheel / C ABI, native DuckDB SQL extension, Browser WASM, Swift, Kotlin, and stdio MCP.
# Forward search, reverse geocode, offline GeoIP, and IANA timezone texspace query --db data/global "10 Downing Street, London, SW1A 2AA" --compact texspace reverse --db data/global --lat 51.5034 --lon -0.1276 --compact texspace geoip --db data/global 8.8.8.8 2606:4700:4700::1111 texspace timezone --db data/global --lat 37.7749 --lon -122.4194 # Parallel bulk CSV geocoding across all CPU cores texspace batch --db data/global --input addresses.csv --output geocoded.csv --threads 0 # Incremental SHA-256 shard update & HTTP API with minutely OSM diff sync texspace update --db data/global --prune-delta texspace serve --db data/global --port 4000 --osm-sync minute
# Forward search (origin-IP proximity sorted by default; override via focus.ip=off|<ip>) curl "https://api.texspace.dev/v1/search?text=Main+Street&format=compact&size=3" # Address verification, deliverability grading, formatted lines & checkout autocomplete curl "https://api.texspace.dev/v1/verify?text=1735+Market+St+Floor+52+Philadelphia+PA+19103" curl "https://api.texspace.dev/v1/autocomplete?text=4865+Miss&focus.point.lat=37.72&focus.point.lon=-122.44&format=compact" # Reverse geocode, GeoIP (+ auto-enriched IANA timezone), and IANA timezone curl "https://api.texspace.dev/v1/reverse?point.lat=51.5034&point.lon=-0.1276&format=compact" curl "https://api.texspace.dev/v1/geoip?ip=8.8.8.8" curl "https://api.texspace.dev/v1/timezone?location=37.7749,-122.4194"
// 100% client-side offline geocoding in browsers (~380 KB gzipped WASM + 951 KB SF city pack) import init, { TexspaceWasm } from './wasm/texspace_wasm.js'; await init(); const bytes = new Uint8Array(await (await fetch('./wasm/sf_city.txw.zst')).arrayBuffer()); const geo = TexspaceWasm.fromZstdBytes(bytes); // pure-Rust ruzstd unpack in memory console.log(JSON.parse(geo.searchJson('4865 Mission St Apt 4B, SF 94112', 3))); console.log(JSON.parse(geo.autocompleteJson('4865 Miss', 5))); console.log(JSON.parse(geo.reverseJson(37.72047, -122.43765, 1)));
-- Vectorized, Rayon-parallel offline SQL geocoding (native DuckDB C-API extension) LOAD 'texspace.duckdb_extension'; SELECT id, addr, g.label, g.lat, g.lon, g.match_level, g.confidence, g.apn FROM ( SELECT id, addr, texspace_geocode('data/global', addr) AS g FROM read_csv('customers.csv') ); -- Also: texspace_reverse(db, lat, lon), texspace_geoip(db, ip), texspace_timezone(db, lat, lon)
use texspace_engine::{QueryOptions, TexspaceEngine}; fn main() -> anyhow::Result<()> { let engine = TexspaceEngine::open("data/global")?; let resp = engine.query("10 Downing Street, London", &QueryOptions::default())?; let ip = engine.geoip("8.8.8.8")?; let tz = engine.timezone(37.7749, -122.4194, None)?; println!("{:?} | {:?} | {}", resp.results.first().map(|r| &r.label), ip.city, tz.tzid); Ok(()) }
from texspace import TexspaceEngine with TexspaceEngine("data/global") as geo: print(geo.search("10 Downing Street, London")) print(geo.reverse(51.5034, -0.1276)) print(geo.geoip("8.8.8.8")) print(geo.timezone(37.7749, -122.4194))
import Texspace let manager = try TexspacePackManager(packsDirectory: packsDir) let (engine, _) = try await manager.ensureEngine( forLat: 37.7749, lon: -122.4194, policy: .init(strategy: .preferCompact, includeWorldBase: true, maxInstalledMetros: 2) ) let hits = try engine.search("4865 Mission St Apt 4B, San Francisco", options: .init(limit: 3))
import dev.texspace.* val manager = TexspacePackManager(File(context.filesDir, "texspace_packs")) val (engine, _) = manager.ensureEngine( lat = location.latitude, lon = location.longitude, policy = SmartDownloadPolicy(strategy = PackSelectionStrategy.PREFER_METRO, maxInstalledMetros = 2) ) engine.use { geo -> geo.search("221B Baker St, London") }
{
"mcpServers": {
"texspace": {
"command": "texspace",
"args": ["mcp", "--db", "/var/lib/texspace"]
}
}
}
// 9 read-only tools: geocode_search, geocode_structured, geocode_reverse, geocode_autocomplete,
// geocode_nearby, geocode_batch, geocode_geoip, geocode_timezone, index_info