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

Feature Request: Change image in source #5794

Closed
jordandalley opened this issue Dec 3, 2017 · 1 comment
Closed

Feature Request: Change image in source #5794

jordandalley opened this issue Dec 3, 2017 · 1 comment

Comments

@jordandalley
Copy link

Hi there,

I have a feature request to be able to change an image url in real time in a source.

For example, if I were to add an image source like the following..

map.addSource('radarimg',{
type: 'image',
url: 'https://someserver.com/image1.png',
coordinates: [
[0, 0],
[0, 0],
[0, 0],
[0, 0]
]
});
map.addLayer({
id: 'radarimg',
source: 'radarimg',
type: 'raster'
});

Now, say I have an array of images that I would like to change on the fly using a setTimeout, something like this:

map.getSource('radarimg').setUrl('https://someserver.com/image2.png');

I have tried setting each individual image as its own layer and source, and turning the layers on and off like in the example here: https://www.mapbox.com/mapbox-gl-js/example/animate-images/

However, in large volumes of images, this is highly inefficient.

If I've missed something here, I apologise. I am a bit of a noob.. :)

@jfirebaugh
Copy link
Contributor

Thanks for the suggestion @jordandalley. This was previously requested; closing as duplicate of #4050.

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

2 participants