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

Spain’s “A-roads” do not necessarily have blue shields #654

Open
1ec5 opened this issue Jan 3, 2023 · 3 comments
Open

Spain’s “A-roads” do not necessarily have blue shields #654

1ec5 opened this issue Jan 3, 2023 · 3 comments
Labels
bug Something isn't working internationalization openmaptiles A change is needed in OpenMapTiles to support this shields

Comments

@1ec5
Copy link
Member

1ec5 commented Jan 3, 2023

Currently, this project assumes that every route relation tagged network=ES:A-road is an autopista or autovía that has a blue shield. Neither assumption is correct with respect to OSM. In reality, Spain’s route designation situation is almost as complex and inconsistent as in the U.S. Although the national government often applies a blue shield and “A-” or “AP-” prefix to autopistas and autovías, many have the prefix “R-” (for radial) or “AP-” (for autopista de peaje), making it less clear whether these routes should be considered “A-roads”.

Meanwhile, each of the autonomous communities has its own conflicting scheme for local autovías. For example, in Andalusía (which happens to start with an A), Autovía A-92 has an orange shield, while Autovía A-382 has a green shield. In Castile and León, Autovía A-231 has a blue shield. In the Basque Country, Autovía AP-1 is neither nationally operated nor tolled but still has the “AP” prefix and blue shield.

Due to the large number of idiosyncrasies, the Spanish community has adopted the ref:colour key to indicate the shield color independently of the route network. It would be better to base the shield selection on this data than to maintain an override list ourselves, since the assigned colors apparently change regularly. The vector tiles would need to expose ref:colour, ideally coalescing similarly hexadecimal color references into more predictable color keywords. In the meantime, maybe we should remove the existing blue-only implementation to avoid confusion:

https://github.com/ZeLonewolf/openstreetmap-americana/blob/e5fe35be2653a0cf96acec634e49fe3df829dce1/src/js/shield_defs.js#L3324-L3328

@1ec5 1ec5 added bug Something isn't working openmaptiles A change is needed in OpenMapTiles to support this internationalization shields labels Jan 3, 2023
@ZeLonewolf
Copy link
Member

The vector tiles would need to expose ref:colour, ideally coalescing similarly hexadecimal color references into more predictable color keywords.

Since it's tagged at the network level, this is feasible. However, remember that network and ref are packed into a single tile attribute per route, so you have something like:

route_1=ES:A-road=AP-1

The ref:color key has 35K usages, so it's not unreasonable to use it. I would need to implement some scheme that packs the value into the string to make this work, perhaps by adding another :<color> on the end of the network portion, for example.

However, this will mean that any other network that happens to use ref:color tag will also get its network value modified as well, so we'd need to be wary of second order effects.

This is exactly the kind of craft-mapped boutique output that I'd encourage in this project...

@1ec5
Copy link
Member Author

1ec5 commented Mar 19, 2024

Once #1032 lands, we’ll be able to make the route’s color part of the image name format. The style will pass this color to the shield rendering code to use verbatim instead of the hard-coded blue background.

@1ec5
Copy link
Member Author

1ec5 commented Apr 4, 2024

As of #1032, each feature has a route_#_color property based on the route relation’s ref:colour=* tag. The name gets plumbed through to the application’s shield selection code, which can now parse it out of the image ID that the stylesheet requests.

route_3_network: ES:AP-highway

We’ll need to modify the shield library’s public interface to pass in an optional color:

https://github.com/ZeLonewolf/openstreetmap-americana/blob/cbad54bf616645bd93f218a079268f52450cee39/shieldlib/src/types.ts#L125-L129

At this point, routeDef.color is still set to the raw tagged color, which could be either a CSS keyword or a hexadecimal triplet. We need to match it to the nearest color in our color palette before passing it into the graphics code:

https://github.com/ZeLonewolf/openstreetmap-americana/blob/cbad54bf616645bd93f218a079268f52450cee39/shieldlib/src/shield.js#L335-L342

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working internationalization openmaptiles A change is needed in OpenMapTiles to support this shields
Projects
Development

No branches or pull requests

2 participants