You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My ultimate goal is to render epsg:27700 tiles as a mapbox-gl layer.
OpenLayers provides a function that essentially takes a tile source and a target tile extents and projection and returns a canvas of the target tile reprojected from source tile(s).
I could implement this as a custom layer but I think it fits much better as an ISource. I want to write something like your RasterTileSource except the loadTile function would also do reprojection.
If I wrote a custom layer I think I would need to figure out things like when to load or abort loading tiles based on map interactions whereas if I could write an ISource your existing code would handle all that.
The documentation for ISource hints at this being possible: "The Source interface must be implemented by each source type, including "core" types like vector, raster, or video) and all custom, third-party types". However, I can't figure out how to do this in practice.
ISource (recursively through Evented) contains a bunch of internal logic so I would want to have my class extend it rather than rewrite all the code needed to conform to the interface. But it isn't exported so I can't access it from an external project.
This makes me think I would have to fork mapbox-gl-js and make a few trivial changes to get a custom ISource to work. Is there a better way to do this?
mapbox-gl-js version: 3.6.0
Question
My ultimate goal is to render epsg:27700 tiles as a mapbox-gl layer.
OpenLayers provides a function that essentially takes a tile source and a target tile extents and projection and returns a canvas of the target tile reprojected from source tile(s).
I could implement this as a custom layer but I think it fits much better as an
ISource
. I want to write something like yourRasterTileSource
except the loadTile function would also do reprojection.If I wrote a custom layer I think I would need to figure out things like when to load or abort loading tiles based on map interactions whereas if I could write an ISource your existing code would handle all that.
The documentation for
ISource
hints at this being possible: "TheSource
interface must be implemented by each source type, including "core" types likevector
,raster
, orvideo
) and all custom, third-party types". However, I can't figure out how to do this in practice.This makes me think I would have to fork mapbox-gl-js and make a few trivial changes to get a custom ISource to work. Is there a better way to do this?
Links to related documentation
mapbox-gl-js/src/source/source.ts
Line 70 in 7f10517
The text was updated successfully, but these errors were encountered: