Modify

Opened 10 years ago

Closed 8 years ago

Last modified 8 years ago

#8071 closed enhancement (fixed)

mapcss concat() and cond()

Reported by: Polyglot Owned by: team
Priority: normal Milestone: 14.01
Component: Core Version:
Keywords: mapcss support Cc:

Description (last modified by Polyglot)

This works:

text: rcn_ref;

or:

text: tag(rcn_ref);

When the name tag is present, this also works:

text: concat(tag(rcn_ref), " ", tag(name));

Without a name tag, no text is shown, though.

So I tried this:

text: name?rcn_ref:concat(tag(rcn_ref), " ", tag(name));

and this:

text: cond(name,rcn_ref,concat(tag(rcn_ref), " ", tag(name)));

Would it be possible to simply add a blank string in concat() if the tag is not available.

That would be the most intuitive.

cond() doesn't work as I would expect it either.

Polyglot

Attachments (0)

Change History (9)

comment:1 Changed 10 years ago by Polyglot

Description: modified (diff)

comment:2 Changed 10 years ago by Polyglot

Description: modified (diff)

comment:3 Changed 10 years ago by Polyglot

The following works:

  text: concat(tag(rcn_ref),cond(has_tag_key(name), concat(" ", tag(name)),""));

This too:

  text: cond(has_tag_key(name),concat(tag(rcn_ref), " ", tag(name)),tag(rcn_ref));

It would be a lot simpler if empty tags were simply replaced by an empty string though.

Polyglot

comment:4 Changed 10 years ago by Polyglot

Resolution: fixed
Status: newclosed

I found an easier way to solve the problem: using different ::layers to show the different tags instead of trying to concatenate them.

comment:5 Changed 10 years ago by bastiK

Resolution: fixed
Status: closedreopened

please keep open

comment:6 Changed 10 years ago by Polyglot

Oh, I'm sorry. It wasn't clear to me whether it was appropriate to have reported it, since there was no reaction (except a more or less negative one, questioning whether it was supposed to work the way I expected it to work) and I managed to solve my problem in another way.

cond() is fine though.

comment:7 Changed 10 years ago by bastiK

I implemented it this way, but it kind of bothers me too.

comment:8 Changed 8 years ago by simon04

Resolution: fixed
Status: reopenedclosed

In 6737/josm:

fix #8071 - MapCSS: skip null values in concat(), provide join(separator, value1, ..., valueN)

comment:9 Changed 8 years ago by simon04

Milestone: 14.01

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.