Skip to content

Unelectrified tracks with errant voltage tag render as electrified for zoom ≤ 8 #130

@epimorphic

Description

@epimorphic

Overall this is a minor issue only affecting a few lines, and it can be avoided by simply tagging correctly on OSM. With that said:

I'd noticed for a long time that the unelectrified San'in Main Line in Japan show up as electrified when and only when zoomed out, even though it's tagged electrified = no. I'd assumed initially that it was some weird tile caching issue, but it turns out the problem is actually bad tagging interacting with an oversight in logic in the code.

Specifically in electrification.mml, #railway_line_low (zoom ≤ 7) and #railway_line_med (zoom = 8) obtain their voltage values from simply rounding the raw tagged voltage from OSM. This contrasts with #railway_line_fill (zoom ≥ 9), which derives its voltage value from the output of the function railway_voltage_for_state. So if a main line tagged electrified = no also has a tagged voltage value, the black or brown line color for matching ["state"="no"], ["state"="deelectrified"], or ["state"="abandoned"] in electrification.mss gets overridden when zoom ≤ 8 by some later selector with higher specificity that are only supposed to match electrified tracks.

Since this happens when the track is mistagged, maybe the correct color is the default "no information" gray.

Screenshots

San'in Main Line, zoom 8 vs 9
Screenshot 2024-08-11 at 12-56-40 OpenRailwayMap
Screenshot 2024-08-11 at 12-57-34 OpenRailwayMap

Línea Central Sur, zoom 8 vs 9
Screenshot 2024-08-11 at 12-58-15 OpenRailwayMap
Screenshot 2024-08-11 at 12-59-14 OpenRailwayMap

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions