Some more queries with nice explanations:
https://wiki.openstreetmap.org/wiki/User:CitySketcher#Overpass_queries
> nwr["amenity"="library"](area:3600295480);
out body;
> // Or:
> area(3600295480)->.searchArea;
(nwr["amenity"="library"](area.searchArea););
> out body;
> >;
> out skel qt;
These are the same as each other. You will likely prefer `out geom;` at
the end of your queries; it outputs all the information you'll need, and
is more consise than the `out body; >; out skel qt;` that's generated by
Overpass Turbo's default settings. They are completely the same as each
other. `out geom;` gives the objects' tags and geometry in one step and
is faster to type. `out body; >; out skel qt;` gives the objects' tags,
then ""recurses down"" (i.e. looks up the underlying nodes that make up
each way, since ways technically don't have geometry of their own), then
gives geometry for those nodes in a second step. Further reading:
https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example
ctrl+f "nowadays"
> but the latter is supposed to be more correct.
Whoever told you that is probably wrong. They're really the same.
Myself, and CitySketcher on the wiki, are both pretty experienced with
the Overpass API, so feel free to get in touch with either one of us if
you need more help writing or understanding queries :)
You can update your page on gemini with this info if you want to.
Cadence
29 Dec 2022 01:01:01 Cadence Ember <cadence@disroot.org>:
> Some more queries with nice explanations:
> https://wiki.openstreetmap.org/wiki/User:CitySketcher#Overpass_queries
>
>> nwr["amenity"="library"](area:3600295480);
> out body;
>> // Or:
>> area(3600295480)->.searchArea;
> (nwr["amenity"="library"](area.searchArea););
>> out body;
>>> ;
>> out skel qt;
>
> These are the same as each other. You will likely prefer `out geom;` at
> the end of your queries; it outputs all the information you'll need,
> and is more consise than the `out body; >; out skel qt;` that's
> generated by Overpass Turbo's default settings. They are completely the
> same as each other. `out geom;` gives the objects' tags and geometry in
> one step and is faster to type. `out body; >; out skel qt;` gives the
> objects' tags, then ""recurses down"" (i.e. looks up the underlying
> nodes that make up each way, since ways technically don't have geometry
> of their own), then gives geometry for those nodes in a second step.
> Further reading:
> https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example
> ctrl+f "nowadays"
>
>> but the latter is supposed to be more correct.
>
> Whoever told you that is probably wrong. They're really the same.
>
> Myself, and CitySketcher on the wiki, are both pretty experienced with
> the Overpass API, so feel free to get in touch with either one of us if
> you need more help writing or understanding queries :)
>
> You can update your page on gemini with this info if you want to.
>
> Cadence
Also, the Overpass Blog has so much neat hidden information!
https://dev.overpass-api.de/blog/index.html
Stack Overflow is pretty sparse for Overpass, so I prefer to read the
published manuals and guides and blogs for help rather than
searching/asking on SO. This approach means I also learn things that I
end up needing later on, rather than merely answering a specific
question.
Trial and error is your friend. Breaking complex queries (>10 lines of
code) into smaller ones is your friend.
Cadence