-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[Feat] Ability to change tiles of raster <Source> #1876
Comments
The |
My workaround is to add a |
I don't think you can reliably change the tiles url of a source in mapbox. Even if you do, I don't think you can get the behavior you are probably looking for where the old tiles are replaced incrementally with the new tiles. Best bet is to recreate the source like you are doing, that way the map will automatically clear the old tiles and repaint. I'm guessing this would be a breaking change because people might be relying on the current behavior. |
react-map-gl does not implement any source on its own. This can only be supported if Mapbox GL JS exposes a public method to update the source, similar to VectorTileSource.setTiles. I suggest you open a feature request in the Mapbox GL JS repo if the current solution does not meet your needs. |
I created a feature request in the mapbox gl js repository. |
any other way we can add raster image ? |
I want to added raster image with their own 4 coordinates |
@fungiboletus I can't seem to make this work-around work...can you point me to an example? I am getting the following error: |
@fungiboletus we have found a way to change tiles dynamically but the transitions are too slow. |
PR merged to main in mapbox-gl-js on Feb 2, 2023 to add useEffect(() => {
mapRef.current?.getSource("source-id")?.setTiles([sourceTmsUrl]);
}, [sourceTmsUrl]); |
What would be really interesting now is a way to avoid tile popping on layer tiles change. 2023-05-11.10.05.10.mp4 |
Target Use Case
I have a
<Source>
of typeraster
in which I would like to change the tiles dynamically.My use case is that my source is a WMS satellite pictures API of an area in which I can select the date (when it's not too cloudy), or the visualisation type (natural colours, temperature, reflection…).
Updating tiles of raster source is unsupported as it throws an exception
Unable to update <Source> prop: tiles
insource.ts
.I tried to create many sources at first and switch them using the
source
attribute of<Layer>
but it doesn't seem to be updated.Proposal
Source of type
raster
could support updating their tiles.The text was updated successfully, but these errors were encountered: