This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

quotes in Overpass Turbo style

1

I was just trying to style an Overpass Turbo result by highlighting all buildings that contain a buildings:levels tag. I tried a query along:

[out:json][timeout:25];
// gather results
(
  nwr[building]({{bbox}});
  nwr[building]["building:levels"]({{bbox}});
);
// print results
out body;
>;
out skel qt;

{{style:
  node, way, relation {color:green;}
  node["building:levels"], way["building:levels"], relation["building:levels"]{color:red;}
}}

According to our wiki in MapCSS tags containing other characters than letters and underscore should be enclosed in quotes. When I try to run above query, though, Overpass Turbo says the style definition got an error.

Is there a way to style non-letter tags in Overpass Turbo?

asked 02 Sep '20, 08:44

TZorn's gravatar image

TZorn
12.3k764225
accept rate: 15%

For the avoidance of doubt - the language used by Overpass Turbo and MapCSS are two completely different things.

(02 Sep '20, 10:26) SomeoneElse ♦

Not according to Overpass Turbo itself. In its help section it epxlicitly refers to MapCSS and links to the wiki page https://wiki.openstreetmap.org/wiki/Overpass_turbo/MapCSS. That page in turn refers to the general MapCSS wiki page: https://wiki.openstreetmap.org/wiki/MapCSS

(02 Sep '20, 10:30) TZorn

One Answer:

1

Removing the quotes completely for the style definition works for me:

[out:json][timeout:25];
// gather results
(
  nwr[building]({{bbox}});
  nwr[building]["building:levels"]({{bbox}});
);
// print results
out body;
>;
out skel qt;

{{style:
  node, way, relation {color:green;}
  node[building:levels], way[building:levels], relation[building:levels]{color:red;}
}}

According to the documentation this is not allowed, though.

answered 02 Sep '20, 09:19

scai's gravatar image

scai ♦
33.3k21309459
accept rate: 23%

I'm probably never going to use a query like this but would someone please take the time to correct the documentation.

Many thanks,

(02 Sep '20, 10:07) AlaskaDave

I'll be damned. I'm pretty sure I had tried that already. But you are right, it does work.

(02 Sep '20, 10:24) TZorn

Source code available on GitHub .