Modify

Opened 23 months ago

#22805 new defect

MAPCSS: Error while parsing a mapcss file (division, comment).

Reported by: mikeho Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: Cc:

Description

1- In some expressions the division did not work well:

tmpDy2: to_double(get(split(".", osm_timestamp() / 86400), 0)) / 365.25);   /* did not work well */

Multiplication works fine:

tmp365: to_double( 1 / 365.25 );        
tmpDy2: to_double(get(split(".", osm_timestamp() / 86400), 0)) * prop("tmp365");  

2- The comments in the line before cause an error!

tmp365: to_double( 1 / 365.25 );                                                   /* comment leads to an error ! */
tmpDy2: to_double(get(split(".", osm_timestamp() / 86400), 0)) * prop("tmp365");   /* comment leads to an error ! */

3- The mapcss style code:

node|z20-[railway=signal]::layer_521 { z-index: 521; text-offset-x: -80; text-offset-y: -40; font-size: 20; text-color: #FFF020; text-anchor-horizontal: right; text-anchor-vertical: below; text-halo-opacity: 1; text-halo-color: #202020; text-halo-radius: 2; text-allow-overlap: true;
    /*                                                 
    tmp365: to_double( 1 / 365.25 );   / * error with an comment on end of line * /
    tmpDy2: to_double(get(split(".", osm_timestamp() / 86400), 0)) * prop("tmp365");    / * error with an comment on end of line * /    
    */
                                                /* day per year / phaser error: division didn't work well (comment in row after accours an error !)  */
        tmp365: to_double( 1 / 365.25 );        
        tmpDy2: to_double(get(split(".", osm_timestamp() / 86400), 0)) * prop("tmp365");  
                                                /* days since 01.01.1970 (comment in row before accours an error !)  */

    /* did not work well                                   with division: 
    tmpDy2: to_double(get(split(".", osm_timestamp() / 86400), 0)) / 365.25);  
    */

    tmpDay: concat( 1970 + prop("tmpDy2"));          /* year with positions after decimal point "2023.12345" */
    tYear:  get(split(".", prop("tmpDay")), 0);      /* year only: - before decimal point - e.g.: "2023"     */
    tmpMo1: get(split(".", prop("tmpDay")), 1);      /* only position after decimal point - e.g.: "12345"    */
    tmpMo2: concat("0.",   prop("tmpMo1"));          /* .. now with "0" and decimal point - e.g.: "0.12345"  */
    tmpMo3: prop("tmpMo2") * 12 + 1;                 /* tmpMo2 * 12 (Month) + 1 (Month) --> 1, ... ,12       */
    tMonth: substring( prop("tmpMo3"), 0, 5 );       /* only e.g. "12.34" (5 digits)                         */
    text:   concat(osm_user_name(), " - ca. Year: ", prop("tYear"), "  ca. Month: ", prop("tMonth") ); 
}

4- The mapcss-file is attached.

Attachments (1)

railway___mapcss_parser_error.mapcss (2.6 KB ) - added by mikeho 23 months ago.

Download all attachments as: .zip

Change History (1)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to mikeho.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


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