Search notes:

Overpass API: Querying an area

The area query seems to find closed ways:
area[name = Engstlensee];
out geom;
Assign the area to a named set and then search within this set:
area[ name ='Calusa Island' ] -> .calusa;

nw[amenity = school] (area.calusa);

out geom;

Use ISO 3166 to find Mc Donald's restaurants in Croatia

Using ISO 3166 to find Mc Donald's restaurants in Croatia:
area[ 'ISO3166-1' = 'HR' ];

nwr[name="McDonald's"](area);

out geom;

area vs {{geocodeArea}}

[out:csv( ::id, type, admin_level, boundary, is_in, name )];

area['ISO3166-2' = 'CH-ZH']           -> .x; .x out;
{{geocodeArea: CH-ZH               }} -> .x; .x out;
{{geocodeArea: Zurich, Switzerland }} -> .x; .x out;

Find all areas in which an object is located

The is_in operator(?)/function(?) can be used to find all areas in which an object is located:
way[name ='Calusa Elementary School'] -> .calusa_school;

node(w.calusa_school)      -> .nodes_calusa_school;
.nodes_calusa_school is_in -> .areas;

.areas out tags;
With the pivot operator(?)/function(?), these areas can also be shown visually:
way[name ='Calusa Elementary School'] -> .calusa_school;

node(w.calusa_school)      -> .nodes_calusa_school;
.nodes_calusa_school is_in -> .areas;

wr(pivot.areas) -> .x;

.x out geom;

Querying an area whose relation id is known

1690227 is the relation id of Kt. Zürich. By adding this number to 3600000000 (=3601690227), it's possible to query an area if the corresponding relation's id is known.
[out:csv(
   ::id,
     name,
    'swisstopo:BFS_NUMMER'
   ;
     false;
    '|'
)];

area(3601690227);         // Select the area of Kt. Zürich

rel[admin_level=8](area); // Find municipalities (CH: admin_level=8) within the selected area

out;
See also the map_to_area function which seems to do more or less the same.

See also

The bbox setting.
The query statement

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758855977, '216.73.216.5', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/OpenStreetMap/API/Overpass/statements/query/area(111): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78