Modify

Opened 11 years ago

Closed 10 years ago

Last modified 10 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 by Polyglot, 11 years ago

Description: modified (diff)

comment:2 by Polyglot, 11 years ago

Description: modified (diff)

comment:3 by Polyglot, 11 years ago

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 by Polyglot, 11 years ago

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 by bastiK, 11 years ago

Resolution: fixed
Status: closedreopened

please keep open

comment:6 by Polyglot, 11 years ago

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 by bastiK, 11 years ago

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

comment:8 by simon04, 10 years ago

Resolution: fixed
Status: reopenedclosed

In 6737/josm:

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

comment:9 by simon04, 10 years ago

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. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.