Modify

Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#10299 closed enhancement (fixed)

MapCSS index for last element of object

Reported by: emmexx Owned by: team
Priority: normal Milestone: 15.04
Component: Core mappaint Version: tested
Keywords: mapcss Cc: lists@…, Klumbumbus

Description

I'd like to create a style where the first node of a highway is red and the last is green.
For the 1st one I used index as in

way[highway] >[index=1] node

But I couldn't find anything about the last element. There's no "last" keyword or pseudo-class in the docs. I tried with eval(count()) but I don't know how to use it in the selector.

Is there a way to accomplish that?

Thank you

maxx

Change History (8)

comment:1 by bastiK, 11 years ago

Not possible at the moment. Suggested syntax: negative numbers count from last to first, so the last node would be way[highway] >[index=-1] node.

comment:2 by Aun Johnsen <lists@…>, 11 years ago

Cc: lists@… added

comment:3 by Klumbumbus, 11 years ago

Cc: Klumbumbus added

comment:4 by simon04, 10 years ago

Resolution: fixed
Status: newclosed

In 8206/josm:

fix #10299 - MapCSS index for last element of object

Negative index numbers count from last to first, so >[index=-1] matches the last one.

comment:5 by simon04, 10 years ago

Keywords: mapcss added
Milestone: 15.04

comment:6 by Klumbumbus, 10 years ago

Nice to see some of these old ticket fixed. Thanks!

comment:7 by simon04, 10 years ago

In 8236/josm:

see #10299 - Remove leftover, unwanted code line

comment:8 by Klumbumbus, 10 years ago

Ticket #10394 has been marked as a duplicate of this ticket.

Add Comment


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