Mahdi
Mahdi

Reputation: 175

How to query Overpass API locally?

I want to run Overpass API locally without the need of internet access on a Raspberry pi zero w.

the solution of API installation is not suitable since it requires a min of 1 GB RAM https://wiki.openstreetmap.org/wiki/Overpass_API/Installation

how can i make my queries locally, which is going to be only in one city. is there any solution to query from OSM file or XML file?

QL used for my purpose:

node(around:300,35.7576,51.4100)[amenity];
(._;>;);
out body;

Upvotes: 2

Views: 1933

Answers (2)

mmd
mmd

Reputation: 3678

You cannot use the standard installation procedure, as even compiling will most likely produce code that crashes later on. Same applies to loading the data.

I put together a comprehensive guide for Raspberry PI 2, which you could use as a baseline: https://wiki.openstreetmap.org/wiki/User:Mmd/Overpass_API/Raspberry

You should use the source code http://dev.overpass-api.de/releases/osm-3s_v0.7.55.tar.gz as mentioned in the official guide. Also, be sure to change the configure options to

./configure CXXFLAGS="-Og -g -fno-omit-frame-pointer -march=native"

otherwise you will get random segmentation faults later on due to unaligned memory accesses (!).

For the update_database command, it's essential to limit the memory consumption by using --flush-size=1, otherwise this process will consume too much memory and will crash.

512MB is really a very limited amount of memory, it might still not be enough in your case.

Upvotes: 2

scai
scai

Reputation: 21519

If you intend to import only one city into your database then you might get away with less than 1 GB RAM. Just try it. However expect queries to be slow.

Queries against OSM XML or PBF files won't work. This raw data needs to get processed first.

Upvotes: 0

Related Questions