I was reading some parts of the doc of this c++ lib, and was wondering if there was a way to query the osm server to get the result (for example) of this query in json:
asked 04 Apr '19, 18:46 Clement edited 05 Apr '19, 10:54 scai ♦ |
One Answer:
Libosmium does not have a networking component, it doesn't talk to any servers. If you want to process the result of the overpass query in your question with libosmium then you'd have to use a different library to execute the HTTP query and then you could feed the response into libosmium for parsing. However, you would not use JSON output for that but raw OSM output - libosmium reads OSM, not JSON. Libosmium provides you with a framework that would allow you to easily extract all bus routes from a country-wide OSM file or even the planet file, without having to query any servers. The osmium command line utility, which is built with the libosmium library, has a "tags-filter" mode that can do what you want. answered 04 Apr '19, 19:01 Frederik Ramm ♦ |
On Linux and MacOS (but not on Windows), you can give a URL to libosmium instead of a file name and it will use
curl
in the background to get the data for you. It is still better to use a HTTP library, because the libosmium-internal way doesn't tell you about errors, but for quick-and-dirty code it is rather convenient.