Opened 10 years ago

Closed 10 years ago

#10063 closed enhancement (fixed)

MapCSS: min() and max()

Reported by: plepe Owned by: team
Priority: normal Milestone: 14.05
Component: Core mappaint Version:
Keywords: Cc:


The eval-functions min() and max() are supported all right in MapCSS. As JOSM also supports lists, it would be nice if I could pass a list to both of this functions and return the smallest (or highest) number.

Attachments (0)

Change History (5)

comment:1 by simon04, 10 years ago

In 7165/josm:

see #10063 - MapCSS: add min() and max() according to standard

comment:2 by simon04, 10 years ago

r7165 allows to specify for instance:

* {
  min_value: min(tag(x), tag(y), tag(z));
  max_value: max(tag(x), tag(y), tag(z));

At the moment, this evaluates to NaN/null if one argument is not defined.

Did you have a different use-case in mind?

comment:3 by plepe, 10 years ago

Yes, I have different use-case in mind. See this example "Highest Peaks" on (which doesn't work for JOSM right now for several reasons - it's quite pgmapcss specific).

I collect the elevation (Tag "ele") of all peaks near the current (child) peak in a list and then I take the maximum element of this list to see if the current peak is higher than all nearby peaks.

In pgmapcss I implemented min(...) to either take several parameters and then return the smallest parameter OR take a single parameter which is interpreted as list (and then the smallest list member).

comment:4 by Don-vip, 10 years ago

Milestone: 14.05

comment:5 by simon04, 10 years ago

Resolution: fixed
Status: newclosed

In 7170/josm:

fix #10063 - MapCSS: make min() and max() work on a list as well

For instance, max(split(";", tag(widths))) splits the tag widths on semicolons and determines the largest numeric value

Modify Ticket

Change Properties
Set your email in Preferences
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.