Quering the nodes from defined bounding box in OpenStreetMap

planet.osm is all OSM data in one file.
See http://planet.openstreetmap.org/ for how to donwload and process it.

Thank you muralito.

If I understood correctly their wiki.openstreetmap.org article, I would have to download this huge (tens of gigabytes) file first in order to extract the appropriate bounding box from it.

That definitively is not what the script should be doing.
I guess the script will not be completed.

There is one thing that is bugging me though:
Why is it perfectly normal for me to download the .osm file directly from the browser:

But it is not, through api.openstreetmap.org:

http://api.openstreetmap.org/api/0.6/map?bbox=4.34870,50.84777,4.35051,50.84872

?

What is the difference in bandwidth, server access … ?

I suspect the web site has been implemented without regard to the usage rules, but it may be difficult to detect when it is the source of a download, and it may not be being used enough to attract attention.

Usage rules is something a server needs to enforce. I guess the lack of a permitted user agent or referer in your request causes some issues here. I don’t recommend to use osm API for this, though.

Thank you hadw.

By OSM API, you mean downloading the .osm file through api.openstreetmap.org. Like this:

http://api.openstreetmap.org/api/0.6/map?bbox=4.34870,50.84777,4.35051,50.84872

?

But OSM API is not the overpass API?

So I can use this:

http://overpass-api.de/api/map?bbox=4.34870,50.84777,4.35051,50.84872

Or not?

Yes, you can. That is well within the purpose of the Overpass API.

In general, please read https://wiki.openstreetmap.org/wiki/Downloading_data
The page explains which ways exist to get data and when to use which.

I’m sorry that the page if difficult to find in the wiki.

Thank you drolbr!
That is very useful.

Do you mind if I ask just one more question please?
That page mentions the following:

The upper two paragraphs make me a bit confused: I need to limit my http://overpass-api.de bounding box size to 0.25x0.25 degrees or 0.5x0.5 degrees?

You can download larger bounding boxes as well. The exact upper limits depends for the bounding box size on the data density. The server may answer several hundred megabytes of data if asked for.

Thank you once again drolbr.

I intend to use the overpass-api.de to download .osm files with bounding box coordinates. The problem is that this script will be used publicly, so not only I will be using. Say 10, or 20 users might use it as well.
So do I need to report to overpass-api.de administrators that the script will be using their api to download the .osm files, and by a couple of tens of users?
I couldn’t find any contact on their website: http://overpass-api.de

You keep confusing the servers.
The EDITING server with the narrow bandwith limit is this one:
http://api.openstreetmap.org/api

Those for READ-access in huge quantities, up to 5GB per day are those:
http://overpass-api.de/api/
http://overpass.osm.rambler.ru/cgi

Please click this LINK and scroll down a bit to a very handy little table.
It shows which servers you can use and which limits:
==>
http://wiki.openstreetmap.org/wiki/Overpass_API

Roland (drolbr) is the single point of contact. However providing a good user agent in your requests which point to your project would a good starting point. If things go wrong it’s possible to contact you or block your script easily

Thank you for the useful replies both wycbtma and mmd.

Do you mind if I ask how to do that?

I’m talking about HTTP User-Agent (https://en.wikipedia.org/wiki/User_agent#Use_in_HTTP). As I don’t know how your script works, I cannot tell you exactly what to do. Maybe you find the following useful: http://www.dougsparling.org/setting-user-agent-curl-wget/

  • don’t forget to adjust it to your project and put something meaningful in there.

That overpasses my current knowledge a bit. I still thank you for the useful reply mmd! I may have to get back it later.

Setting an HTTP User-Agent is essential basic knowledge and not just a nice to have that you can get back to later. Even worse if you are working on automated downloads and have no idea about it.

Hence my urgent advise: please familiarize yourself with this concept before continuing with your activities. If you can’t manage it on your own, consider getting some help.

Thank you mmd.