Search notes:

Overpass API function u

The purpose of u(…) is to return a single unique value for a set (typically with exactly one member/element).
If the set has no element, an empty string is returned, if the set has mulitple elements with different values, u(…) returns < multiple values found >.

Use in foreach

The following query finds elements whose ele value end in m or m. and outputs then in JSON.
[out:json];
nwr[ele~'\s*m\\.?$'];

foreach {
   make x
    ::id   = u(id()),
//  ::type = u(type()),    // why oh why does that not work?
//    id   = u(id()),      // ::id works, therefore commented!
      type = u(type()),
      ele  = u(t['ele']);
 
   out;
}

See also

Compare with the set function which returns a text where the set's members's values are separated by a semicolon.
Overpass API: functions

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...', 1758867817, '216.73.216.5', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/OpenStreetMap/API/Overpass/functions/u(60): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78