react-mapbox-gl icon indicating copy to clipboard operation
react-mapbox-gl copied to clipboard

Add image source and video source

Open alex3165 opened this issue 8 years ago • 12 comments

https://www.mapbox.com/mapbox-gl-js/api/#ImageSource https://www.mapbox.com/mapbox-gl-js/api/#VideoSource

alex3165 avatar May 13 '16 13:05 alex3165

Will do this as soon as I can :)

kitten avatar May 22 '16 19:05 kitten

Little complication: These should maybe be converted into Layers, but what if there are a lot of videos to be added? Do we have to combine these layers? Or do we have to integrate sources and layers separately? That would make this library a lot more complicated...

So probably just simple Video and Image components that are picked up by the map component and combined into a single layer?

kitten avatar Sep 07 '16 20:09 kitten

should behave like GeoJSONSource

Altiano avatar Oct 30 '16 04:10 Altiano

is this working? i cant seem to add an image source, keeps saying that source id not found

benjaminhon avatar Jul 05 '17 03:07 benjaminhon

Me neither. There doesn't seem to be the ability to add a type: 'image' to source either.

vjpr avatar Sep 07 '17 22:09 vjpr

Sorry I closed this issue at the time because no one seemed really interested in those features. I will re-open it and try to find some time to work on it then.

alex3165 avatar Sep 08 '17 11:09 alex3165

I really interested!

Altiano avatar Sep 10 '17 07:09 Altiano

Will try to get this done in v4

alex3165 avatar Feb 12 '18 20:02 alex3165

I am interested as well

valgussev avatar Dec 30 '19 23:12 valgussev

Any progress / workarounds here?

Afbcary avatar Apr 20 '20 20:04 Afbcary

Any progress / workarounds here?

agunescu avatar Sep 28 '20 12:09 agunescu

For anyone coming across this issue these days, while react-mapbox-gl doesn't support images or videos. You can always grab the mapbox api directly and insert something by hand.

For example here is a small use effect that should get you moving:

	useEffect(() => {
		if (map && isImageSource && defaultSource) {
			const [sourceId, source] = defaultSource;

			if (!map.getSource(sourceId)) {
				map.addLayer({
					id: sourceId,
					type: "raster",
					source,
				});
			}
		}

		return () => {
			if (map && isImageSource && defaultSource) {
				const [sourceId] = defaultSource;

				if (map.getSource(sourceId)) {
					map.removeLayer(sourceId);
				}
			}
		};
	}, [map, defaultSource, isImageSource]);

Georift avatar Jun 22 '21 04:06 Georift