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

Failure to load style from local ~~Enable raster-only loading~~ #61

Open
discobanco opened this issue Jan 16, 2022 · 2 comments
Open

Failure to load style from local ~~Enable raster-only loading~~ #61

discobanco opened this issue Jan 16, 2022 · 2 comments

Comments

@discobanco
Copy link

discobanco commented Jan 16, 2022

In order to add new sources, at the moment, one has to wait for the mapReady event to fire (else they won't show up), and for that to happen, a token and an initial style are needed. Given that the functionality is handy and some users may not require access to mapbox specific servers (if they are using openstreetmaps for example), would it be possible to bypass the initial check?
I'm guessing it would be an easy fix, but not sure where to start, so throwing it here, to see if someone has found a quick fix or a workaround. Thank you!

@discobanco
Copy link
Author

discobanco commented Jan 16, 2022

It seems to be possible to have raster-only sources in the original API:
https://docs.mapbox.com/mapbox-gl-js/example/map-tiles/

@discobanco discobanco changed the title Enable raster-only loading Failure to load style from local ~~Enable raster-only loading~~ Jan 18, 2022
@discobanco
Copy link
Author

So it seems one can use raster-only configuration as long as they use their own custom json style.
However, the local access using ~/ seems to fail. Traced the parsed URL and it's all correct, ( return 'file://' + path.join(knownFolders.currentApp().path, input.replace('~/', '')); ) ==> I use the same exact method to load the tiles, and that works. So I'm guessing it's a problem with the call itself.
My current workaround is having a hosted super-simple style json background which is the easiest thing for it to load, once that one is loaded I apply my layers pointing at local tiles:
https://raw.githubusercontent.com/discobanco/phoenix-dark-style-container/main/style.json
Surely there's a better way, but so far this is the only that worked! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant