3

I'm trying to query all the amenities in my neighborhood but find that the result set has a bunch of amenity-nodes without a name tag.

I want to filter these nodes out.

After reading the Overpass Language reference wiki (here) - http://wiki.openstreetmap.org/wiki/Overpass_API/Language_Guide#Tag_request_clauses_.28or_.22tag_filters.22.29

where it says

["key"!~"value"] filter objects tagged with this key but a value not 
                 matching a regular expression

The following returns nothing.

/*
This has been generated by the overpass-turbo wizard.
The original search was:
“amenity=*”
*/
[out:json][timeout:25];
// gather results
(
  // query part for: “amenity=*”
  node["amenity"];node["name"!~"^$"]({{bbox}});
  way["amenity"]({{bbox}});
  relation["amenity"]({{bbox}});

);
// print results
out body;
>;
out skel qt;

1 Answer 1

1

Type

amenity=* and name=*

in query wizard and remove [name] from ways and relations

It gives

/*
This has been generated by the overpass-turbo wizard.
The original search was:
“amenity=* and name=*”
*/
[out:json][timeout:25];
// gather results
(
  // query part for: “amenity=* and name=*”
  node["amenity"]["name"]({{bbox}});
  way["amenity"]({{bbox}});
  relation["amenity"]({{bbox}});
);
// print results
out body;
>;
out skel qt;

It will list all ways, all relations and named nodes.

1
  • Awesome. Thanks so much @mateusz-konieczny
    – vr00n
    Commented Jan 8, 2018 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.