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

Generating raster tile instead of fetching from url #9897

Closed
dkegle opened this issue Jul 26, 2020 · 2 comments
Closed

Generating raster tile instead of fetching from url #9897

dkegle opened this issue Jul 26, 2020 · 2 comments

Comments

@dkegle
Copy link

dkegle commented Jul 26, 2020

I have spatial data which is too large to be displayed as a single raster overlay. Tiles need to be generated. However, it is not possible to generate them on the server. The data comes to client in a compressed private format.

LeafletJS has layer called GridLayer, which enables you to do this. Instead of giving url to fetch tiles, you can write your own function which takes tile parameters (x,y,z) as input, and returns generated tile as result (div, canvas or img). This is short example in the docs:
https://leafletjs.com/reference-1.6.0.html#gridlayer

As a real world example, this very powerful approach is used here:
https://www.windy.com/

Is there anything similar in Mapbox GL JS? How would one approach this problem? Is it even possible to do this?

@ryanhamley
Copy link
Contributor

Hi @dkegle GL JS doesn't have a correlate to Leaflet's GridLayer. I think the way you'd want to to approach this is to generate your tiles client-side, then add the tiles as a raster source. There's a few older issues that reference similar ideas such as #7390, #5597 and #9280. If you need further help getting this set up, I'd recommend contacting Mapbox Support.

@douglasg14b
Copy link

douglasg14b commented Feb 7, 2021

@ryanbaumann I think the question is asking "How do I have mapbox call my local function with params x,y,z for tiles" Not necessarily constraining it to rasters.

This is a need I also have. I need to generate tiles on the fly client-side, in addition to the normal map tiles retrieved on the server, in order to render a grid. These would be vector tiles, not raster tiles.

Can mapbox call a local function to retrieve map tiles on-demand for a layer?

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

3 participants