Opened 9 years ago

Last modified 9 years ago

#14332 closed defect

Maybe get() is wrong in MapCSS — at Version 1

Reported by: naoliv Owned by: team
Priority: normal Milestone:
Component: Core validator Version:
Keywords: mapcss Cc:

Description (last modified by naoliv)

Have any object with species (for example, species = Foo bar).

Use this example to validate it:

*[species] {
        throwWarning: tr("{0}", split(" ", tag(species)));
}

After validating we can see a warning about [Foo, bar].
So right, we can split the value in a list with two values.

Now suppose I want to get the first element from this list.

From what I understand from https://josm.openstreetmap.de/wiki/Help/Styles/MapCSSImplementation#Evalexpressions it's just necessary to use get(lst, n) where lst is the list (which we already have it above) and n the element, starting at 0:

*[species] {
        throwWarning: tr("{0}", get(split(" ", tag(species))), 0);
}

But with this we can only see a message saying null.
Using 1 as the element number also gives the same problem.

For this example I would like to get the Foo value only.

Am I missing something here, there is some detail about get() that is not documented or it's not working as expected, please?

JOSM:

URL:http://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2017-02-04 17:52:07 +0100 (Sat, 04 Feb 2017)
Build-Date:2017-02-05 02:33:05
Revision:11540
Relative:URL: ^/trunk

Identification: JOSM/1.5 (11540 pt_BR) Linux Debian GNU/Linux 9.0 (stretch)
Memory Usage: 453 MB / 3005 MB (195 MB allocated, but free)
Java version: 1.8.0_121-8u121-b13-2-b13, Oracle Corporation, OpenJDK 64-Bit Server VM
Screen: :0.0 1920x1080
Maximum Screen Size: 1920x1080
Java package: openjdk-8-jre:amd64-8u121-b13-2
Java ATK Wrapper package: libatk-wrapper-java:all-0.33.3-13
VM arguments: [-Dawt.useSystemAAFontSettings=on]
Dataset consistency test: No problems found

Change History (1)

comment:1 by naoliv, 9 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.