I would like to be able to download .pbf files of OSM data extracts directly through the Overpass API (or suitable alternative) using wget, cURL or something similar from the command line. My goal is to be able to specify a country name (using a country boundary for the extract) to be used in the Overpass API request, like this:
I've been working with the documentation for this here, but can't figure out how to download a .pbf formatted file directly. So far I can only get a download of .osm format file to work, with this:
I tried several methods of converting the .osm to a .pbf using osmconvert, osmosis, ogr2ogr, etc after downloading, but ran into problems or documentation that I couldn't follow to set the options properly in all cases. It seems like downloading directly to .pbf format is the simplest method, maybe I am missing something basic to specify this. To summarize my key asks, I would like: * to download directly from the command line * data in .pbf format * to use country boundaries (such as offered with name=<countryname>) in the Overpass API for the extract specification My environment is a Mac. Thanks! asked 04 Apr '18, 21:31 neutronbarn |
What you're asking will put a high burden on the Overpass server since it has to collect all the data for the whole country. Overpass will refuse to do this for all but the smallest countries, and rightly so - a few people downloading a whole country like that could easily make the server unusable for everybody else. So: don't do it. Instead, download the nightly updated country files from download.geofabrik.de; if the fact that these are slightly larger than the exact country boundary is a problem, run an "osmium" or "osmosis" step afterwards to cut out the precise country extent. If what you're looking for is not found on download.geofabrik.de, head over to extracts.bbbike.org where you can request custom extracts for arbitrary polygonal areas; they, too, have a size limit but they will allow larger files than Overpass. answered 04 Apr '18, 22:35 Frederik Ramm ♦ It sounds like cutting at the country boundary after download from geofabrik is what I want. I'll give this a try with osmium and osmosis. Thanks for the description of why not to do this on the Overpass server.
(04 Apr '18, 22:40)
neutronbarn
|