mapbox/mapbox-gl-js

FR: Expose method for rendering single tile to canvas

d1manson opened this issue · 3 comments

I've not used any of the code yet, but I have had a look through, and couldn't find a simple way to render a single tile to a specific point on a canvas. Something like:

.renderTile(tileData, elCanvas, {x,y,w,h}, options)

Ideally the function would return a promise/accept a callback, for when the rendering is done, but I know that might not be easy to accomplish with WebGL 1.0.

As I understand it, you're asking for an API that allows you to render map tiles at an arbitrary spot in your canvas as part of a more complex rendering. Is that correct?

We don't have an API that does this. You may be able to accomplish this end by rendering Mapbox GL to one canvas and then copying it into your other canvas, where the more complex rendering is taking place.

Closing because this is not an API we would be able to support in the medium term.

For anyone interested, I am now building something that does what I wanted. It doesn't seem to be too hard...but I'm only interested in my specific use case...

https://gist.github.com/d1manson/a987e6af63a47129ab54c73b31a7b1bd