Add Digitransit vector map source#683
Conversation
|
It is a touch ugly hack, indeed. What if we
That way we will be able to update the style without releases (for example if some URL changes internally).
Is it better? Or kinda hacky as well :) |
That's certainly better than the current state of this PR. I tried implementing this, but apparently MapboxGL / Maplibre loads all the resources from the style before their URLs can be modified in This could be worked around here by loading the URL contents in python, modifying it and the setting the style as a string to |
I was expecting that it would still get to process_style, but maybe an error is triggered before. I wonder if we need to make some separate option for map style to be fetched from URL via python before applying the style. it just has to be done via bg call - have to check if it runs already accordingly in the code or has to be set to do so in QML when new style is loaded |
Add
DIGITRANSIT_KEYAPI key. Replace the API key placeholder inurl_suffix(not needed here, but why not) andstyle_jsonvalues in the map definition.The vector map definitions fetched from
api.digitransit.fipatch the API key given in thedigitransit-subscription-keyrequest parameter given to it to the tile URLs, so we cannot useurl_suffix, because this then appends the API key twice.A somehow working solution is to use
style_jsonin the map source with the JSON fetched from https://raw.githubusercontent.com/HSLdevcom/hsl-map-style/master/style.json and edited to add the API key parameter only to the base vector map URL (also edited to remove some other vector sources).Since this is an ugly hack, I'm not at all sure if this should be merged, especially since the amount of users this is likely to have is small. But, if you disagree, I can mark this as ready.