Choose your region
The region is specified by a bounding box, which consists of a minimum and maximum latitude and longitude. Choose as small a region as will be useful to you, since larger regions will result in larger data files, longer download times, and heavier load on the server. The server may reject your region if it is larger than 1/4 degree in either dimension. When you’re first starting out, choose a very small region so that you can figure things out quickly with small data sets.
There are several ways of finding latitude and longitude values. Since we are interested in a bounding box, perhaps the clearest way is to use the bounding box selection features of the ‘export data’ link. On the homepage map pan and zoom to roughly the right area, and then click the ‘export data’ (link on the left). This sidebar display includes the four values you need for a bounding box matching the extents of the viewport. Click ‘Manually select a different area’ and then drag a box to select exactly the region you want.
Construct a URL for the HTTP API
You must now construct an API request URL as specified in the map request docs. In the URL, a bounding box is expressed as four comma-separated numbers, in this order: left, bottom, right, top (min long, min lat, max long, max lat). Latitude and longitude are expressed in decimal degrees. North latitude is positive, south latitude is negative. West longitude is negative, east longitude is positive. The method described in the previous section will give you suitable values.
The API is limited to bounding boxes of about 0.5 degree by 0.5 degree and you should avoid using it if possible. For larger areas you might try to use XAPI, for example:
Refer to the XAPI page for details of other servers available.
Download the data
You can just type this URL into a browser if you want, but that may not work as well as you’d hope, especially if the data is large. If you know how to use them, command-line tools like wget and curl will do a better job.
If you’ve specified a region with a lot of data, you may have to wait a while before the HTTP response begins (the server is crunching your request). If your client times out, try setting options for a longer timeout, or choose a smaller region.
Here’s an example command line for wget:
wget -O muenchen.osm "https://api.openstreetmap.org/api/0.6/map?bbox=11.54,48.14,11.543,48.145"