maplibre / maputnik

An open source visual editor for the 'MapLibre Style Specification'
https://www.maplibre.org/maputnik
MIT License
2.02k stars 380 forks source link

MapTiler Access Token does not get added to URLs #869

Open rsalzer opened 5 months ago

rsalzer commented 5 months ago

I tried to use a JSON style in which MapTiler-Datasource are used. I left all the key={key} in there in order for Maputnik to replace it when I add it in the "Style Setting".

Unfortunately it does not apply them.

Steps to reproduce:

image
HarelM commented 5 months ago

I would say that I hoped maptiler would be inclined to fix this, but they have their editor, so I'm not sure any help would come from there. Having said that, maputnik codebase is small and you should be able to find and fix this issue.

HarelM commented 5 months ago

The code around replacing the access token is weird, and potentially buggy, or does not expect this flow. Since the keys should be part of the style, I believe you should simply set them in the relevant source and not expect maputnik to replace it.

Bottom line, more of a feature than a bug :-)

rsalzer commented 5 months ago

Then the bottom line would be to remove those fields which suggest that it works ;)

A better flow would probably be to offer values which maputnik replaces ... {key} or {maptilerKey} and then replaces them everywhere.

HarelM commented 5 months ago

It works for glyphs and maybe sprites I believe. But for sources there's a bunch of code that I didn't understand...

rsalzer commented 4 months ago

Probably it would be quite easy to add a possibility to add variables (in the shape of {variable}) which then can get replaced. Like this it would be universal ... I might add a PR