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

New 'updateMapboxSource()' utility function #1009

Merged
merged 1 commit into from
Nov 2, 2023

Conversation

ahocevar
Copy link
Member

@ahocevar ahocevar commented Oct 27, 2023

Fixes #1008.

updateMapboxSource(mapOrGroup, id, mapboxSource): Promise<Source>

Updates a Mapbox source object in the style. The according OpenLayers source will be replaced
and the map will be re-rendered.

Parameters
Name Type Description
mapOrGroup Map | LayerGroup The Map or LayerGroup apply was called on.
id string Key of the source in the sources object literal.
mapboxSource any Mapbox source object.
Returns

Promise<Source>

Promise that resolves when the source has been updated.

@ahocevar
Copy link
Member Author

@simonseyock, do you want to see if this supports your use case?

@ahocevar ahocevar merged commit 985a20f into openlayers:main Nov 2, 2023
1 check passed
@ahocevar ahocevar deleted the update-mapbox-source branch November 2, 2023 12:33
@simonseyock
Copy link
Member

Sorry for not responding, I will test this in this week.

@simonseyock
Copy link
Member

@ahocevar I finally was able to test this. It works really nice, but there is one problem: Sometimes I would want to update a source and a layer at the same time. This causes two renders, where one is in an incomplete state.

I have ways to circumvent this, and probably do not have time in the project anymore to test any proper solutions for this problem. Wanted to report my findings anyways.

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

Successfully merging this pull request may close these issues.

Make source available in transformRequest
2 participants