User:Mmd
From OpenStreetMap Wiki
Contents
Overpass API examples
All of the following examples are not supported on the official Overpass API instance at overpass-api.de!
Export highways in current bounding box in PBF format
[out:pbf];
way[highway]({{bbox}});
(._;>;);
out meta;
{{data:overpass,server=http://dev.overpass-api.de/api_mmd/}}
Export highways in current bounding box in OPL format
[out:opl];
way[highway]({{bbox}});
(._;>;);
out meta;
{{data:overpass,server=http://dev.overpass-api.de/api_mmd/}}
ICU regular expression support
Also see https://www.openstreetmap.org/user/mmd/diary/40197
Nodes with Chinese (Han) characters in current bounding box
// switch to ICU Regexp implemenation
// see http://userguide.icu-project.org/strings/regexp
[regexp:ICU];
node({{bbox}})["name"~"[\\p{script=Han}]"];
out meta center;
{{data:overpass,server=http://dev.overpass-api.de/api_mmd/}}
No-U-Turn Relations with from = to member
[timeout:30];
// No-u-turn restrictions mit from = to
rel[restriction=no_u_turn][type=restriction]({{bbox}})
(if:count_by_role("via") == 1 &&
count_by_role("from") == 1 &&
count_by_role("to") == 1);
foreach -> .rel(
way(r.rel:"from") -> .w_from;
way(r.rel:"to") -> .w_to;
if ( w_from.min(id()) == w_to.min(id()) )
(
.rel out geom meta;
);
);
// Depends on 0.7.55+ features:
{{data:overpass,server=http://dev.overpass-api.de/api_mmd/}}