-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add support for MapTiler SDK #199
base: main
Are you sure you want to change the base?
Conversation
@petr-hajek Thanks for this! We'll be taking a look at this soon. |
It's my first PR into this project and for full transparency, MapTiler is my client so I am open to any feedback. Thanks a lot. Anyway, this is a great tool! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good here!
I left a long explainer for this, but basically I think we may need to switch the order of our ||
conditional here to be style || url
as opposed to how it is now.
We'll also want to QA that change and make sure there's no weird side effects.
cc @ebrelsford
Sorry for not responding. I was loaded with other things, but I'll try get back to this soon, thanks for the feedback. |
Sorry it took me so long. I moved the url normalization to a separate file and apply it in the GlMap component as well. It now works with Maplibre and Mapbox renderer as well. |
@@ -50,7 +51,9 @@ | |||
let mapViewProps = {}; | |||
|
|||
// We can set style (an object) here because mapStyle only changes when it needs to | |||
$: ({ style, url } = mapStyle); | |||
$: ({ style, url: baseUrl } = mapStyle); | |||
$: url = normalizeMapTilerUrl(baseUrl, $configStore.maptilerApiKey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this works, but feels like it isn't totally following existing patterns. By adding a Maptiler key property in our config, we're treating these URL's more similar to a Mapbox URL despite the fact it doesn't have a custom Maptiler protocol (in the way Mapbox has a custom protocol). In theory, if we were to treat Mapbox URLs like this, we would normalize all Mapbox URL's here as well and allow them to also be rendered by Maplibre or Maptiler.
I'm debating whether to:
- move forward with this with a comment to rethink how this pattern works
- apply the same logic to Mapbox URL's to allow them to run on different renderers
- or force the user to either use the Maptiler SDK with this pattern or use the URL with key as a param when wanting to use other renderers.
@ebrelsford can you chime in here with your thoughts on the pattern? Let me know if my explanation here isn't clear enough.
Description
As a user of MapTiler SDK & MapTiler maps I'd like an easy way how to compare also MapTiler maps.
With this PR I can add MapTiler API key to the config (similar to MapBox). I can also use MapTiler SDK as a renderer (it's almost the same like MapLibre).
I removed the duplicate code in Map.svelte
QA steps
Probably some basic regression of MapLibre & MapBox but should not be affected
Author checklist
Create the PR
After approval
main
into your branch, resolve any conflictsmain