User:Breki/Overpass API Installation

From OpenStreetMap Wiki
Jump to: navigation, search

Introduction

This document tries to give a step-by-step guidance on installing Overpass API on your own computer.

The installation procedure described was done on Ubuntu 16.04.2 for Overpass API v0.7.54.

  • goals
  • which version of Ubuntu (link)
  • which version of Overpass
  • include caveats - newby Linux user etc.
  • warning about paths

Installation Procedure

Installing Prerequisite Packages

These packages are needed so you can compile Overpass API package and run it. Apache web server is also included.

sudo apt-get update
sudo apt-get install g++ make expat libexpat1-dev zlib1g-dev apache2

Downloading Overpass API Tarball And Compiling The Source Code

We will organize all Overpass files in the /home/igor/overpass directory. For simplicity reasons, Overpass binaries will be built inside the sources directory.

cd Downloads
wget http://dev.overpass-api.de/releases/osm-3s_v0.7.54.tar.gz
mkdir overpass
cd overpass
tar -zxvf ../Downloads/osm-3s_v0.7.54.tar.gz
cd osm-3s_v0.7.54/
./configure --prefix="`pwd`"
make

Downloading Sample OSM Data

We are using a Isle of Man sample extract from Geofabrik since it is small and (mostly) self-contained.

cd Downloads/
wget http://download.geofabrik.de/europe/isle-of-man-latest.osm.bz2
cd ..

Populating Overpass API Database

First we make sure the scripts will have the necessary access to the Overpass files:

chmod -R 755 overpass

For testing reasons, we will do the populating in-process since it should not take too long for such a small dataset.

osm-3s_v0.7.54/bin/init_osm3s.sh ../Downloads/isle-of-man-latest.osm.bz2 db osm-3s_v0.7.54

For larger datasets, it is better to use nohup command so the process can continue to run even if the user logs out:

nohup osm-3s_v0.7.54/bin/init_osm3s.sh ../Downloads/isle-of-man-latest.osm.bz2 db osm-3s_v0.7.54 &

(note that the ending & character means the command will run in the background).

The database will be stored in the /home/igor/overpass/db directory.

Running A Sample Query

Now we are ready to run a sample query on the imported data. Enter command

osm-3s_v0.7.54/bin/osm3s_query --db-dir=db

... and then copy & paste this sample query into the prompt:

node["amenity"="post_box"];
out skel;

... and press Ctrl+D to start the query. It should return skeleton OSM data about all post box nodes on Isle of Man.

Links And Resources