earthwyrm 0.2.0

Vector tile map server for openstreetmap data
Documentation

EarthWyrm Logo

EarthWyrm is an open-source map server developed for the Minnesota Department of Transportation (MnDOT). It can serve OpenStreetMap (and other) data in MVT format.

Setup

  • Install linux and dependencies (available from linux repositories):

    • PostgreSQL 9+
    • PostGIS 2.4+
    • osm2pgsql 0.96+
    • cargo 1.31+
    • nginx (optional)
  • Download OpenStreetMap data in .osm.pbf (OSM protobuf) format. See the OSM wiki for download options, such as Geofabrik.

  • Create database and import data

createdb earthwyrm
psql earthwyrm -c 'CREATE EXTENSION postgis'
time osm2pgsql -v --number-processes=8 -d earthwyrm --multi-geometry -s --drop ./[map-data].osm.pbf
  • Grant select permissions to public
psql earthwyrm
GRANT SELECT ON planet_osm_polygon TO PUBLIC;
GRANT SELECT ON planet_osm_line TO PUBLIC;
GRANT SELECT ON planet_osm_roads TO PUBLIC;
GRANT SELECT ON planet_osm_point TO PUBLIC;
\q
  • Configure PostgreSQL access for UNIX domain sockets

Edit /var/lib/pgsql/data/pg_hba.conf: change local method to peer. Restart PostgreSQL server.

  • Build earthwyrm
git clone https://github.com/DougLau/earthwyrm.git
cd earthwyrm
cargo build --release
  • Install (as root)
cp target/release/earthwyrm /usr/local/bin/
sh ./examples/site/install.sh
  • Start the server
systemctl enable earthwyrm
systemctl start earthwyrm
systemctl status earthwyrm

Customizing

By default, EarthWyrm will listen on the IPv4 loopback address. This means clients from other hosts will not be able to reach the server. There are a couple of options:

  • Update bind_address in /etc/earthwyrm/earthwyrm.toml
  • (Preferred option!) Set up a reverse proxy, such as nginx. This has the advantage that caching can be enabled to improve latency.

In either case, the url in /var/lib/earthwyrm/map.js will need to be updated.