Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#14332 closed defect (invalid)

Maybe get() is wrong in MapCSS

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

Attachments (0)

Change History (5)

comment:1 by naoliv, 8 years ago

Description: modified (diff)

comment:2 by Klumbumbus, 8 years ago

Resolution: invalid
Status: newclosed

The closing parenthesis of the get() is at the wrong position. It must be after , 0

correct syntax:

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

comment:3 by naoliv, 8 years ago

Thanks!
https://upload.wikimedia.org/wikipedia/commons/thumb/b/bc/Paperbag_head.jpeg/563px-Paperbag_head.jpeg

comment:4 by Klumbumbus, 8 years ago

You're welcome :)

in reply to:  4 comment:5 by openstreetmap.org-user-d1g, 8 years ago

Replying to naoliv:

Thanks!

Replying to Klumbumbus:

You're welcome :)

Mutal "thank you", some outstanding communication here!

PS. I'm so tired with other channels...

Last edited 8 years ago by openstreetmap.org-user-d1g (previous) (diff)

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.