-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Bug] Custom Map Style loading failure #2560
Comments
Confirmed this is reproducible. Here's the stack trace with this url:
|
@ilyabo @birkskyum Some leftovers from the maplibre transition? |
The bug with the "Add style" button not being clickable actually predates the work on maplibre transition. This bug was i.e. reported here Nov 29, 2023: The maplibre transition PR merged and published Dec 19-21, 2023 That said, MapLibre iirc also requires the style to be a normal http(s):// url instead of the mapbox:// - I think we can look up somewhere what the actual url to prepend is if the mapbox api license allow for it. |
Looks like the issue (or one issue) is that the Making these changes seems to help: diff --git a/src/components/src/modal-container.tsx b/src/components/src/modal-container.tsx
index a26e7579..77152824 100644
--- a/src/components/src/modal-container.tsx
+++ b/src/components/src/modal-container.tsx
@@ -434,7 +434,7 @@ export default function ModalContainerFactory(
onConfirm: this._onAddCustomMapStyle,
confirmButton: {
large: true,
- disabled: !mapStyle.inputStyle.style,
+ disabled: !mapStyle.inputStyle.url,
children: 'modal.button.addStyle'
}
};
diff --git a/src/components/src/modals/add-map-style-modal.tsx b/src/components/src/modals/add-map-style-modal.tsx
index f5e27343..72703488 100644
--- a/src/components/src/modals/add-map-style-modal.tsx
+++ b/src/components/src/modals/add-map-style-modal.tsx
@@ -194,7 +196,7 @@ function AddMapStyleModalFactory() {
<InputLight
type="text"
value={inputStyle.url || ''}
- onChange={({target: {value}}) => this.props.inputMapStyle({url: value})}
+ onChange={({target: {value}}) => this.props.inputMapStyle({url: value, id: 'Custom Style
' })}
placeholder="e.g. https://basemaps.cartocdn.com/gl/positron-gl-style/style.json"
/>
</StyledModalSection> Of course, the icon is broken, but this appears to be the basic fix. |
The |
Let's decide that we are going to remove the mapbox URL protocol. However, to avoid future confusion, we should do it right. There are a bunch of references to in docs and code to mapbox:// url protocol. There could also be some screenshots.
If we can keep support for V1 styles that would be preferable, but I am still confused as to what is supported in maplibre and what is not. |
Any mapbox v1 style will still be supported by maplibre, albeit when passed as http://, not mapbox://, because there has yet to be introduced a breaking change in the style spec. The style spec is in general quite stable and changes mainly by addition. |
So then it seems reasonable to not support I've seen a few cases where assets within map style jsons are loaded via |
@akre54 that's exactly my case 😅 I have a base url defined as |
to be able use |
Great find @sahitono. Would you be able to open a pull request? |
Any updates on this one? Are you going to open a PR that fixes it using |
Nice! Thanks for adding this. What do you mean by the maplibre map initialize? Kepler uses react-map-gl to construct the base maplib. If you need to call a function on load, for instance, you can use the |
Describe the bug
I am not able to load my Mapbox map style in Kepler.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Add style button should be selectable.
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: