Talk:Overpass turbo/MapCSS

From OpenStreetMap Wiki
Jump to navigation Jump to search

Support for Labels

Do you plan to include support for labels and maybe derive label texts from actual tags (or maybe even several tags + string operations)? Mmd (talk) 09:19, 13 April 2013 (UTC)

Yes, but I'm not sure about some implementation details yet. It'll be pretty basic, I guess: no fancy label-collision-prevention, no text along paths, etc. - just simple captions at the center of or right next to features. Getting the label text from single tags will be pretty straight-forward. More customizing (multiple tags, etc.) could be done via MapCSS-evals.
This can/will also be implemented for the popup-contents.
--Tyr (talk) 16:52, 13 April 2013 (UTC)

No rendering of nodes

Is there a way to suppress the rendering of nodes in Overpass Turbo (apart from opacity: 0; fill-opacity: 0; ?). I only want to see the ways. Thanks! Nillerdk (talk) 08:37, 17 October 2013 (UTC)

Not via MapCSS in the moment, but there is a handy Overpass trick if you do not want to see the additional data of child elements: the skeleton output mode. So instead of http://overpass-turbo.eu/s/1ie you can just use http://overpass-turbo.eu/s/1if and really only get your ways without any unwanted by-catch. ;) --Tyr (talk) 10:01, 17 October 2013 (UTC)
Thanks! I wasn't aware of the different print-modes! Now the nodes don't show, but some short ways seem to be displayed with circles: http://overpass-turbo.eu/s/1jK. Do you know what is going on? Nillerdk (talk) 11:16, 21 October 2013 (UTC)
Yes, in principle, this is expected behaviour: As soon as a line or polygon gets smaller than a certain threshold, it is rendered with a marker just like a POI. This is necessary to get a “fair” visibility of small objects at low zoom levels (otherwise, when searching for sparsely distributed features you would always be able to see POI nodes but not POI buildings!). That said, I know that under some circumstances (like in your example) this rendering can be quite annoying. At the moment you can only deactivate this feature globally in the settings (settings->map->checkbox at “Don't display small features as POIs”). But, I'm working on a better solution for this.
PS: See this enhancement ticket for further details. --Tyr (talk) 12:45, 21 October 2013 (UTC)

What exactly is "overpass query"?

The page says: <osm-script> ... your overpass query here ... </osm-script> What exactly is "overpass query" in it?

Beacuse the following code returns an error:

Example code

and the error reads: An error occured during the execution of the overpass query! This is what overpass API returned:

Error: line 1: static error: Element "osm-script" must not contain text.

--Rmikke (talk) 19:34, 4 November 2015 (UTC)

http://wiki.openstreetmap.org/wiki/Overpass_turbo/MapCSS#How_to_Use should be now better Mateusz Konieczny (talk) 22:16, 4 November 2015 (UTC)
Hm. I've now changed all examples to use Overpass QL and just dropped the XML-variant (as it is considered obsolete by now).
What do you think?
--Tyr (talk) 07:46, 5 November 2015 (UTC)

maki...

does not support .png anymore (?) Dex2000 (talk) 17:21, 16 March 2017 (UTC)

The icon set is now in SVG format (https://github.com/mapbox/maki/tree/master/icons), but it's easy to derive PNG sets for any size we want, or just add support in MapCSS to include SVG icons directly (unless there are browser problems compatibility to view the rendered maps, but I think we already depend on SVG for rendering Overpass turbo results. The SVG specs already defines simple way to embed or reference SVG icon sets for markers, so I don't think this is a problem). Using SVG would still allow better rendering notably on smartphones with Hi-DPI displays. — Verdy_p (talk) 18:28, 16 March 2017 (UTC)
Hi Verdy, my opinion was not to find a solution. What i mean is, that the wiki-page is wrong for that. Dex2000 (talk) 19:00, 16 March 2017 (UTC)
How exactly is the wiki-page wrong on that? For me, (legacy) maki icons still work on overpass-turbo.eu: http://overpass-turbo.eu/s/nzj --Tyr (talk) 19:30, 16 March 2017 (UTC)
Uh, have not tried this... But the Link to github in #Icon_Sets doesnt works. Dex2000 (talk) 20:06, 16 March 2017 (UTC)
Yes that link is dead. I suggest replacing it (but in fact the icon set is managed in the overpass development repository which holds its own local copy of the icons). I'd say that the link in this page is just informative about its original source. But it is not needed to have Overpass turbo/MapCSS working and being installable (anyway, users of MapCSS can choose the icons sets they want for their stylesheets, any implementation of MapCSS should not depend on the avaiability of the original Maki repository which may change at any time without notice).
But I think that Maki developers should have better left the links to PNG icons still working as is, even if they are no longer maintained, as they were clearly in a separate folder and did not cause any conflict with newer SVG icons; their storage cost in their repository was very small.
May be we can replace the links to PNG icons by a link on one mirror (such as the mirror already made within Overpass's repository). — Verdy_p (talk) 22:41, 16 March 2017 (UTC)
Oh, this is about the links on the wiki-page. Yeah, let's improve that. I put in a link to the old legacy (v0.5) maki icons, which are the ones available on overpass-turbo. And thanks Verdy_p for making it more clear that this section is about the icons that come "pre-installed" with overpass-turbo and that one is not limited to these! -- Tyr (talk) 08:13, 17 March 2017 (UTC)

Different styles for different result sets

I'm using overpass turbo to check which "entities" in OSM do/don't have wikidata tags. This is not just about nodes/ways/rels themselves that have wikidata tags, but e.g. if the rel has a wikidata tag, then all nodes/ways within the "logical entity" are deemed to be tagged. This means in mapcss, I cannot simply use node[wikidata] to show nodes that have/don't have wikidata.

The way I do this in overpass is to calculate the set of objects (with a specific tag, say amenity=school) that have wikidata (or are in a relation/way that has wikidata; call this set .WIKIDATA), and then calculate the set of all objects (.ALLDATA). I can then display either WIKIDATA or (.ALLDATA; - .WIKIDATA;) -> .NOWIKIDATA. However, I'd like to display both on the same map, but styled differently.

is there a mapcss feature, whereby I can display both, styled differently? E.g. similar to the "." selector in overpass QL? E.g. in overpass, I can say "node.WIKIDATA, way.WIKIDATA", or "node.WIKIDATA[amenity=school], way.WIKIDATA[amenity=school]", but this does not seem to be possible with mapcss? I.e.

{{style:
 node.WIKIDATA {
 ...
 }
 node.NOWIKIDATA {
 ...
 }
}}

I can see why it's not possible - probably because the CSS doesn't know about result sets, or cannot attach classes to result sets. Any ideas how I could achieve this? Bjohas (talk) 12:36, 29 April 2017 (UTC)

Child selectors

I guess a partial solution is to use child selectors, i.e. not just node[wikidata], way[wikidata], relation[wikidata], but also "relation[wikidata] node", etc. I.e.

node[wikidata], way[wikidata], relation[wikidata], relation[wikidata] node, relation[wikidata] way, relation[wikidata] relation {
}

It doesn't catch cases where a way is tagged, but the relationship isn't. However, arguably it should always be the relation that's tagged anyway. Bjohas (talk) 12:50, 29 April 2017 (UTC)

Convert

The 'convert' statement Overpass_API/Overpass_QL#The_convert_statement would allow adding tags, and those tags could then presumably be used for CSS purposes. However, because it removes lat/lon the resulting data cannot be placed on a map. (Unless I'm misunderstanding something.) Bjohas (talk) 17:43, 29 April 2017 (UTC)

Example for "set"

This may be related: Would somebody be able to give an example, ideally in overpass-turbo, for the following:

Declarations may also be used to set the value of certain tags on an object:
{ set tag=value; }   /* set a tag */
{ set tag; }         /* set a tag to 'yes' */

and

You can set tags beginning with a full-stop to simulate classes:
{ set .minor_road; }
You can then use the .minor_road test (as above) in the selector:
way.minor_road

Many thanks! Bjohas (talk) 00:01, 12 May 2017 (UTC)

Support for string functions ?

Nice to have text: name . " - " . ref; or text: concat(name, " - ", ref);

See String_functions.

--Pyrog (talk) 09:11, 19 June 2020 (UTC)

Sorry, not even
node {text: concat("a","b")}
works. Jidanni (talk) 21:19, 8 May 2021 (UTC)

How to suppress markers for short ways?

Short ways are rendered as round markers in not very high zoom levels by default; example: https://overpass-turbo.eu/s/1GPA. Can these round markers be suppressed (and these ways rendered like the longer ones)? How? I could not find it. --Hufkratzer (talk) 21:09, 2 February 2024 (UTC)

It's hidden in the settings "Don't display small features as POIs."
—— Kovposch (talk) 06:06, 3 February 2024 (UTC)