maplibre / maputnik

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

API Key Issue when switching styles #942

Open harbinc opened 1 month ago

harbinc commented 1 month ago

I have recently installed Maputnik locally on Ubuntu.

I am able to load Maputnik with no issue but with blank maps.

Blank map until I add the API key to Datasource and then API key for Style Settings Glyphs.

Can I make my API key persistent so I am not having to enter the API key each time I select a different style. Note I installed using Homebrew.

Thanks :)

HarelM commented 1 month ago

I think you can store the API key in the style file itself, can't you?

HarelM commented 1 month ago

CC: @kevinschaul

harbinc commented 1 month ago

@HarelM Is the style file downloaded to the local filesystem? I am using the public data sources.

HarelM commented 1 month ago

In the desktop version you should be working with a local file as far as I know, otherwise you can simply use the web version, which use the browser's local storage...

harbinc commented 1 month ago

@HarelM I am accessing Maputnik via browser. The API key is not storing in local browser storage for some reason. There are no style files on my installation, all public styles are being accessed externally. I am running maputnik executable only.

HarelM commented 1 month ago

That's annoying... Feel free to open a PR so solve this...

harbinc commented 1 month ago

Thanks @HarelM

Before I submit a PR. Can you confirm that my installation is correct. The installation instructions on Maputnik Github did not work in my case.

Brew Installation: brew install kevinschaul/homebrew-core/maputnik

Executable: /home/linuxbrew/.linuxbrew/bin/maputnik -- file style.json

Using empty style.json file with the following.

{ "version": 8, "name": "Map with OpenMapTiles", "metadata": {}, "sources": { "openmaptiles": { "type": "vector", "url": "https://api.maptiler.com/tiles/v3-openmaptiles/tiles.json?key=MY_API_KEY" } }, "sprite": "", "glyphs": "https://orangemug.github.io/font-glyphs/glyphs/{fontstack}/{range}.pbf?key=MY_API_KEY", "layers": [] }

HarelM commented 1 month ago

I'm using the online version, so this might be a limitation of the desktop version. Does this issue exists in the online version (maplibre.org/maputnik)?