[英]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.我想在本地运行 Overpass API,而无需在 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 API 安装的解决方案不合适,因为它需要至少 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?
是否有任何解决方案可以从 OSM 文件或 XML 文件中查询?
QL used for my purpose: QL 用于我的目的:
node(around:300,35.7576,51.4100)[amenity];
(._;>;);
out body;
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我整理了一份 Raspberry PI 2 的综合指南,您可以将其用作基准: 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.您应该使用官方指南中提到的源代码http://dev.overpass-api.de/releases/osm-3s_v0.7.55.tar.gz 。 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.对于 update_database 命令,必须使用
--flush-size=1
来限制内存消耗,否则此进程将消耗过多内存并崩溃。
512MB is really a very limited amount of memory, it might still not be enough in your case. 512MB 确实是非常有限的内存量,在您的情况下它可能仍然不够。
If you intend to import only one city into your database then you might get away with less than 1 GB RAM.如果您打算仅将一个城市导入到您的数据库中,那么您可能会得到不到 1 GB 的 RAM。 Just try it.
就试一试吧。 However expect queries to be slow.
但是预计查询会很慢。
Queries against OSM XML or PBF files won't work.对 OSM XML 或 PBF 文件的查询将不起作用。 This raw data needs to get processed first.
需要首先处理这些原始数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.