maplibre-rs icon indicating copy to clipboard operation
maplibre-rs copied to clipboard

Raster Tile Rendering

Open maxammann opened this issue 3 years ago • 10 comments

We want to be able to render raster tiles. This is required for rendering data sets like "Natural Earth". Raster tiles can be of any web-native image format like PNG or WEBP.

🤔 Expected Behavior

Raster tiles need to be scaled and transformed like vector tiles.

😯 Current Behavior

No raster tiles are supported.

💁 Possible Solution

The WebGPU spec offers a way to load bitmaps to textures: https://toji.github.io/webgpu-best-practices/img-textures.html In the browser this requires the createImageBitmap() API which offloads decoding of images to the browser.

🔦 Context

💻 Examples

maxammann avatar May 03 '22 08:05 maxammann

Any ideas about implementation of this feature?

ybiletskyi avatar Jun 03 '22 12:06 ybiletskyi

This is currently blocked by wgpu. The copyExternalImageToTexture is not yet available and need to be implemented in wgpu. The devs of wgpu said that this is probably not very hard to do. So if you want to work on this then this would be a valuable contribution :)

maxammann avatar Jun 03 '22 13:06 maxammann

Got it. Thanks for update. I'll try to implement it in wgpu.

ybiletskyi avatar Jun 06 '22 06:06 ybiletskyi

Just as a note: I have a personal interest in this feature! At the moment, I'm using MapLibre (JavaScript) on my personal site to overlay .webp images of environmental drone imagery I've collected. The site's backend is actually written in Rust, and I'd love the opportunity to re-write this particular application with maplibre-rs as well, which is dependent on raster imagery being available (and symbols). Really excited about this project, so just wanted to mention a use case I'd personally be delighted to have support for at some point. I don't have a ton of capacity for new contributions at the moment, but if you need support for something like testing for either this project or the wgpu feature, just let me know!

quietlychris avatar Jun 12 '22 03:06 quietlychris

Hey. I just created a PR to wgpu. It probably take a time to merge it. But it's not a blocker any more for start this feature implementation.

ybiletskyi avatar Jun 17 '22 08:06 ybiletskyi

@ybiletskyi, @Quillasp might also be interested in working on this as part of his bachelor thesis. I wondered whether collaboration could make sense. If not it shouldn't be hard to find two distinct areas to work on in maplibre-rs.

maxammann avatar Jun 20 '22 12:06 maxammann

It's not a problem for collaboration. I'll be happy to work with @Quillasp. But need to analyze and estimate amount of work. Maybe this feature not so big for 2 dev collaboration. In that case I might to switch to another feature.

ybiletskyi avatar Jun 20 '22 13:06 ybiletskyi

@Drabble can you check with @Quillasp?

maxammann avatar Jun 20 '22 14:06 maxammann

@Drabble gave me an overview of the project today. But the project is still quite big (for me at least), do you have any idea where I should start looking in the code to see where I could implement the basics of this feature ? (sorry for the noob question)

quillasp avatar Jun 21 '22 21:06 quillasp

Probably you should add new layer with type raster link that represent raster tiles on a map. Than you add logic for loading data (io module I supose) and processing data. After that I think you can start to render data.

ybiletskyi avatar Jun 22 '22 08:06 ybiletskyi