Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maxspeed rendering when :forward and :backward have different values. #78

Open
UncleOwen opened this issue Apr 4, 2022 · 2 comments
Open
Assignees
Labels

Comments

@UncleOwen
Copy link

UncleOwen commented Apr 4, 2022

https://openrailwaymap.org/?style=maxspeed&lat=53.639433463029626&lon=9.905867278575897&zoom=18

As far as I can tell, the current rules are something like that:

  • When maxspeed:forward and maxspeed:backward have different values, use maxspeed:forward for the coloring
    • When railway:preferred_direction=backward, use maxspeed:backward instead
  • In either case, label the track with maxspeed:forward (maxspeed:backward)

I like the first two rules. But could we please label the track with maxspeed:backward (maxspeed:forward) if railway:preferred_direction=backward to make things consistent?

In my example link above, I would expect the western track to be labeled "70 (80)" instead of "80 (70)"

@UncleOwen
Copy link
Author

My knowledge of SQL is somewhat rudimentary, but railway_speed_label seems to already do what I want?! I assume that speed_arr[3] = 2 is the railway:preferred_direction=backward, right? Then why don't I get the rendering as described above?

@DerDakon DerDakon added the style:maxspeed maxspeed style label Oct 28, 2022
@Daml
Copy link

Daml commented Sep 18, 2023

Hi,

I have the same problem here : https://www.openrailwaymap.org/?style=maxspeed&lat=45.55638300449401&lon=5.416975915431976&zoom=18 (french network, left-hand running).

Both track must be labeled "140 (120)".

A first inversion is well done here :

IF preferred_direction = 'backward' THEN
RETURN ARRAY[railway_speed_int_noconvert(backward_speed), railway_speed_int_noconvert(forward_speed), 2] || railway_imperial_flags(backward_speed, forward_speed);
END IF;

But then it's done a second time here :

IF speed_arr[3] = 2 THEN
RETURN null_to_dash(railway_add_unit_to_label(speed_arr[2], speed_arr[5])) || ' (' || null_to_dash(railway_add_unit_to_label(speed_arr[1], speed_arr[4])) || ')';
END IF;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants