Hi there,

I have a problem to understand how the API works.

These two lines work well:

wget -c http://api.openstreetmap.fr/xapi?"node[waterway=wreck][bbox=-27,29,44,72]" -O EU_Wrecks-1.osm
wget -c http://api.openstreetmap.fr/xapi?"node[historic=wreck][bbox=-27,29,44,72]" -O EU_Wrecks-2.osm

But when I try to combine them it doesn't:

wget -c http://api.openstreetmap.fr/xapi?"node[waterway|historic=wreck][bbox=-27,29,44,72]" -O EU_Wrecks.osm

Any hints for me? Tnx...

PS: Seems it worked once: https://wiki.openstreetmap.org/wiki/User:Sparcuser

asked 26 Apr '17, 13:51

MeriMapper's gravatar image

MeriMapper
11114
accept rate: 0%

edited 26 Apr '17, 16:57


Rather than "node[waterway|historic=wreck]" you need to do something like "(node["waterway"="wreck"];node["historic"="wreck"];);"

Also note that the wizard of https://overpass-turbo.eu/ can be very helpful for figuring out what works

permanent link

answered 26 Apr '17, 14:29

Hjart's gravatar image

Hjart
2.8k42455
accept rate: 18%

Thanks for your answer!

I tried wget -c http://api.openstreetmap.fr/xapi?"(node["waterway"="wreck"];node["historic"="wreck"];);[bbox=-27,29,44,72]" -O EU_Wrecks.osm and got ERROR 400: Bad Request.

When I send only the http part in my broser I get:

Error in ["(node["waterway"="wreck"];node["historic"="wreck"];)]: Error: Query must start with 'node', 'way', 'relation', or '*'

Tested with dozends of variants with or without brackets, quotes, ... :-P

(26 Apr '17, 17:15) MeriMapper

In the Overpass Turbo wizard mentioned above I wrote "type:node & (waterway=wreck | historic=wreck)", which it then translates to QL code.

(when tested from inside JOSM the result is a bit different)

What I'm not at all sure about here is how to transform the result into something that will fit into a commandline string like yours

(26 Apr '17, 19:11) Hjart

The Overpass server implements an XAPI compatibility layer. I don't know it well, it may not support the combined query.

You can use the Overpass QL to do the query though, I think Hjart has written their answer in the QL. Here's the query in Overpass Turbo:

http://overpass-turbo.eu/s/oDz

(Click "Run" to see the output)

Under "Export" there is a link "raw data directly from Overpass API" that is suitable for use with wget.

The query language is documented here: http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL

permanent link

answered 26 Apr '17, 17:50

maxerickson's gravatar image

maxerickson
10.8k1073151
accept rate: 30%

edited 26 Apr '17, 17:51

Your answer
toggle preview

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:

×355
×64
×41

question asked: 26 Apr '17, 13:51

question was seen: 1,440 times

last updated: 26 Apr '17, 19:16

powered by OSQA