0

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:

wget "http://overpass-api.de/api/interpreter?data=node[name=\"Singapore\"];out;"

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:

wget -O target.osm "http://overpass-api.de/api/interpreter?data=node[name=\"Singapore\"];out;"

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's gravatar image

neutronbarn
14113
accept rate: 0%

edited 04 Apr '18, 22:13


One Answer:
2

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.

permanent link

answered 04 Apr '18, 22:35

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
73.3k866641137
accept rate: 24%

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

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×377
×68
×51
×6

question asked: 04 Apr '18, 21:31

question was seen: 1,806 times

last updated: 04 Apr '18, 22:40

powered by OSQA