Skip to content

Lightweight geocoder in pure Rust

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE_APACHE
MIT
LICENSE_MIT
Notifications You must be signed in to change notification settings

ellenhp/airmail

Repository files navigation

📫 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

  • Index OpenStreetMap data, from osmx or pbf file.
  • Index OpenAddresses data (not currently used in demo).
  • Index WhosOnFirst data.
  • API server.
  • Address queries.
  • Named POI queries.
  • Administrative area (city, province/state, country etc) queries.
  • Prefix queries.
  • Query remote indices.
  • Support and test planet-scale indices.
  • International address queries.
  • Categorical search, e.g. "coffee shop seattle".
  • Typo tolerance (limited to >=8 character input tokens)
  • Bounding box restriction.
  • Focus point queries.
  • Systematic/automatic quality testing in CI.

Quickstart

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

Requirements

  • Rust environment, Docker with Docker Compose, or Podman with Podman Compose.
  • ~16GB memory and 10-100GB of free space.

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.

About

Lightweight geocoder in pure Rust

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE_APACHE
MIT
LICENSE_MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 3

  •  
  •  
  •