Skip to content

Instantly share code, notes, and snippets.

@oeon
Last active October 6, 2015 18:28
Show Gist options
  • Save oeon/3035152 to your computer and use it in GitHub Desktop.
Save oeon/3035152 to your computer and use it in GitHub Desktop.
using cURL or Wget in Windows to download from OSM Overpass API

###This guide will give you the tools and show you how to download from the OpenStreetMap Overpass API on Windows. These steps were documented while setting up a Windows 7 64-bit machine.###

cURL and Wget are similar utilities to help you download things from the Command Prompt, either one will work - I think cURL might be easier to setup, but depending on your IT restrictions, etc. one or the other might work. You DO NOT need to do both steps A and B, one or the other. But if one method fails, try the other!

  • A - cURL 0. get cURL

    1. download http://curl.haxx.se/latest.cgi?curl=win64-nossl from your closest mirror
    2. depending on your operating system version, download and install the appropriate Microsoft Visual C++ Redistributable dll from this webpage http://answers.microsoft.com/en-us/windows/forum/windows_7-windows_programs/the-program-cant-start-becuase-msvcr100dll-is/5c9d301a-2191-4edb-916e-5e4958558090 - - this is because you would get an error message The Program can't start becuase MSVCR100.dll is missing from your computer. Try reinstalling the program to fix this problem. without doing so.
    3. to extract curl.exe from the .zip file you downloaded - I open 2 Windows Explorer windows. In one, navigate to C:\Users\YourUserNameHere\Downloads\curl-7.23.1-win64-nossl.zip, or wherever you download cURL - in the other, navigate to C:\Users\YourUsernameHere the drag curl.exe from the 1st window into here (or extract it there). This makes it easy so that when you press the Windows logo button on your keyboard and type "cmd", then pressing enter, you'll have direct access to curl.exe because Command Prompt opens to the C:\Users\YourUsernameHere path. Typing curl and pressing enter should return curl: try 'curl --help' or 'curl --manual' for more information You did it! skip the B - Wget section and continue.
  • B - Wget 0. get Wget http://gnuwin32.sourceforge.net/packages/wget.htm

    1. download the Binaries .zip file and extract to a known location - - C:\Users\YourUsernameHere\Downloads\wget-1.11.4-1-bin worked fine for me.
    2. also download the Dependancies .zip file from the same page in step 0 - files in this archive will need to go into the same /bin/ directory where you have wget.exe or else you'll get a This can't start because LIBEAY32.DLL is missing from your computer. Try reinstalling the program to fix this problem. error. This webpage explains this step in length if you're having trouble http://www.openmutual.org/2011/08/gnu-wget-missing-libeay32-dll-on-new-install-on-windows/
    3. You should now be able to navidate to C:\Users\Intern\Downloads\wget-1.11.4-1-bin\bin in Windows Explorer, hold Shift and right-click, select Open command window here, type wget and pressing enter returns some text, with the last line saying Try 'wget --help' for more options. You did it! - proceed to the next paragraph.

Once you have cURL or Wget working you can (sheesh!, finally) pass some parameters to the Overpass API to download OpenStreetMap data. Why we like Overpass is because we can download LOTS of data or only certain features or only certain data edited by certain usernames or from a certain date - all kinds of stuff...

Here's an example with cURL: curl -o your_file_name.osm -g http://overpass.osm.rambler.ru/cgi/xapi?*[building=*][bbox=-121.34792,34.89752,-119.47262,35.79522][@meta] sometimes these servers go down, you may need to hit the other server: http://www.overpass-api.de/api/xapi?*[building=*][bbox=-121.34792,34.89752,-119.47262,35.79522][@meta] https://gist.github.com/2853949

The same thing with Wget: wget -O your_file_name.osm http://overpass.osm.rambler.ru/cgi/xapi?way[building=*][bbox=-121.34792,34.89752,-119.47262,35.79522][@newer=2012-07-01T00:00:00Z][@meta] https://gist.github.com/3035057

Copy either of those commands - maybe helpful to simply click 'raw' from those pages and paste into Command Promt by right-clicking, Paste.

Remember you can customize the parameters you throw at Overpass - I find this page most helpful for that http://wiki.openstreetmap.org/wiki/Overpass_API/XAPI_Compatibility_Layer#Meta_Data

@KarSho
Copy link

KarSho commented Jan 10, 2014

You can find Causes and Solutions for,

The Program can't start because MSVCR100.dll is missing from your computer.
Try reinstalling the program to fix this problem.

at here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment