Closed am2222 closed 11 months ago
Mapbox raster layers have no paint properties for styling https://docs.mapbox.com/style-spec/reference/layers/#raster. You can't set a list of colors or a ramp for elements, as the raster itself it's just an image and it's not styled in the client.
@markusand Yeah I understand the limitation. But my point is that if we have a TMS layer added to the map that shows a tiled land-use layer using a geoserver or any other TMS servers and we want to add the color correspondence to each land-cover on the legend we cannot. I was thinking of adding a way to pass an array of color, label
to the legend for the raster layers so the user can manually send this information to the legend.
For this specific case I suggest to simply create an overlay ul and fill it with all the content you'd like it to have. This library relies in events and layer modelling from Mapbox, adding such a feature means to create a totally new legend.
@markusand That sounds great. However I am using react and manipulating HTML dom outside of the react seems to be discouraged. I will try it tho.
Thanks!
Hi, Is it possible to support the raster layer? Like when we have a TMS or wms layer which has color classes (like a landcover map).
We have discrate, classified and continues rasters. I see legend already supports such data type. I feel we can read these information from layer metadata when source type is raster. A descrate and classifoed raster can have oprion to manually feed classes/color as key value pair and for the continues raster we can have a color ramp or an array of colors (max 100).
I can add its PR if you think this is something we can add to this project.