Home

Awesome

📫 Airmail 📫

Airmail is an extremely lightweight geocoder1 written in pure Rust. Built on top of tantivy, it offers a low memory footprint and fast performance. Airmail aims to support international queries in several languages, but in practice it's still very early days and there are definitely bugs preventing correct behavior.

Features

Airmail's killer feature is the ability to query remote indices, e.g. on S3. This lets you keep your index hosting costs fixed while you scale horizontally. The baseline cost of a global Airmail deployment is about $5 per month.

Roadmap

Quickstart

This guide will create an index with a chosen geographical region (or the planet!) and run Airmail.

Requirements

Clone the Repo

git clone git@github.com:ellenhp/airmail.git

cd airmail

mkdir ./data

Fetch Data

It's a good idea to build a smaller region first, and then planet if you have the need and space. This guide references Australia, but you can use any region.

  1. Download OSM probuf file (.pbf file) for the target region of interest. See: https://download.geofabrik.de or https://download.bbbike.org/osm/planet/ and place into ./data folder.
  2. Download Who's On First (SpatiaLite format). For planet see: https://geocode.earth/data/whosonfirst/combined/ and https://data.geocode.earth/wof/dist/spatial/whosonfirst-data-admin-latest.spatial.db.bz2
  3. Ensure files are present and decompressed in the ./data/ directory.

Option 1 - Docker

# Build the images
docker compose build

# Build the index (from a pbf)
docker compose run indexer \
indexer --wof-db /data/whosonfirst-data-admin-latest.spatial.db \
--index /data/index/ \
load-osm-pbf /data/australia-oceania-latest.osm.pbf

# Launch the service
docker compose up airmail

Option 2 - From Source

# Install deps
apt-get install -y libssl-dev capnproto clang pkg-config libzstd-dev libsqlite3-mod-spatialite

# Run indexer
cargo run --bin indexer -- \
--wof-db /data/whosonfirst-data-admin-latest.spatial.db \
--index /data/index/ \
load-osm-pbf /data/australia-oceania-latest.osm.pbf

# Run service
cargo run --bin airmail_service -- \
--index /data/index/

License

Dual MIT/Apache 2 license, at your option.

Footnotes

  1. A geocoder is a search engine for places. When you type in "vegan donut shop" into your maps app of choice, a geocoder is what shows you nearby places that fit your query. ↩