NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi, I made a query that does what I want, http://overpass-turbo.eu/s/e97 but I found no info on how to put in a single to invoke from a script like wget <query>. Any help is welcomed.

asked 02 Feb '16, 19:51

davide_ttk's gravatar image

davide_ttk
21112
accept rate: 0%

edited 02 Feb '16, 20:57

aseerel4c26's gravatar image

aseerel4c26 ♦
32.6k18248554


Remove comments and newlines. You should get something like this:

[out:json][timeout:25];(node (poly: "45.5 11 45.6 11.6 45.2 11")["natural"="peak"];);out body;>;out skel qt;

urlencode that string. You can use this http://meyerweb.com/eric/tools/dencoder/ or any other tool for urlencode.

Get the encoded string and slap it in wget:

wget -O result.json "http://overpass.osm.rambler.ru/cgi/interpreter?data=%5Bout%3Ajson%5D%5Btimeout%3A25%5D%3B(node%20(poly%3A%20%2245.5%2011%2045.6%2011.6%2045.2%2011%22)%5B%22natural%22%3D%22peak%22%5D%3B)%3Bout%20body%3B%3E%3Bout%20skel%20qt%3B"

permanent link

answered 03 Feb '16, 07:09

ivanatora's gravatar image

ivanatora
2.7k355568
accept rate: 7%

You can try to use Overpass API

wiki page: [1]: http://wiki.openstreetmap.org/wiki/Overpass_API

site page: http://overpass-api.de/

and for a page that explain how to use it from a command line (or in your case from a script) see this page: http://overpass-api.de/command_line.html

Please note this two point:

1) the main server has an usage policy (see the wiki page about that)

2) the syntax used by Overpass api may be different from the one used by Overpass Turbo (I am not sure about this, there are two many languages used, I get confused)

permanent link

answered 02 Feb '16, 20:41

AnyFile's gravatar image

AnyFile
403
accept rate: 0%

Thanks AnyFile it was exactly what I needed

(02 Feb '16, 22:20) davide_ttk
  • In overpass turbo run your query.
  • Click on export button and choose raw data from overpass api.
  • Use the url of the page you landed on for wget.
permanent link

answered 02 Feb '16, 20:34

RM87's gravatar image

RM87
3.3k23753
accept rate: 22%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

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:

×483
×10
×1
×1

question asked: 02 Feb '16, 19:51

question was seen: 3,289 times

last updated: 03 Feb '16, 07:09

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum