searching with overpass-turbo.eu - AND statement

I can’t quite understand the query language for http://overpass-turbo.eu/

How would I search for:

natural=beach
AND
surface=sand
AND
fee=N

Reference: http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL

Also, are there Android apps to run (and bookmark) this type of low level searches?

If you need logical AND, clauses can be concatenated. So:

way[natural=beach][surface=sand]fee=N;
relation[type=multipolygon][natural=beach][surface=sand]fee=N;

Two things: first - we also include relations with type=multipolygon, because that’s how areas can also appear in OSM if they contain holes or their outline is for whatever reason segmented into many ways. Secondly - the {{bbox}} is a shortcut of the overpass turbo and not the core element of Overpass API. It inserts either coordinates of your map viewport or the bounding box you set using the button. Normally with Overpass API you would insert bounding coordinates of your query here.

I agree the guide is not very easy to follow, even though this is basic stuff and should be there.

The general idea is that each statement is a set of filters that receive data from their left to only let some of it pass through to the right.


way - all the ways in OSM
[natural=beach] - Only lets the natural=beach nodes through to the next filter
[surface=sand] - Only lets surface=sand through to the next filter
({{bbox) - Only lets the nodes in that particular area to the next filter
; - Semicolon. No more filters, this is the final result for this statement.

With your help, I got it working; thank you very much!

[out:json][timeout:25];
// gather results
(
  ( node["natural"="beach"]["fee"="yes"]({{bbox}}); );
  ( way["natural"="beach"]["fee"="yes"]({{bbox}}); );
  ( relation["type"="multipolygon"]["natural"="beach"]["fee"="yes"]({{bbox}}); );
);
// print results
out body;
>;
out skel qt;

Cosmetic coding:
Is there a way to combine similar queries (node and way) into one line?

After all, it’s a wiki. Everyone’s free to go ahead and improve it!