leaflet-grayscale | Grayscale TileLayer for Leaflet | User Interface library
kandi X-RAY | leaflet-grayscale Summary
kandi X-RAY | leaflet-grayscale Summary
Grayscale TileLayer for Leaflet
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of leaflet-grayscale
leaflet-grayscale Key Features
leaflet-grayscale Examples and Code Snippets
Community Discussions
Trending Discussions on leaflet-grayscale
QUESTION
I'm currently using two plugins for leaflet: https://github.com/ghybs/Leaflet.TileLayer.Fallback to allow my map to fall back to higher zoom levels if a tile for the current zoom level is not available. https://github.com/Zverik/leaflet-grayscale to make my background map tiles grey scale. I would like to be able to do both at the same time.
I tried making the grey scale plugin extend the fallback object, but that didn't work.
How can I make leaflet-greyscale rather extend TileLayer.Fallback rather than just TileLayer?
Ideally I want a new FallbackGreyscale object or maybe something like L.tileLayer.fallback.greyscale. But any way in which I can have both fallback and grey scale at the same time would be nice.
...ANSWER
Answered 2019-May-20 at 08:31Leaflet-grayscale uses an inefficient method to convert the image to grayscale: drawing into a canvas. This is done for compatibility with older browsers. Using this technique makes it work in IE, but complicates compatibility.
If you are only targetting browsers which implement the filter CSS rule, the easiest way to accomplish what you want is to modify the _tileOnError()
method of Leaflet.TileLayer.Fallback so it applies a grayscale filter style to the tile, i.e..:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install leaflet-grayscale
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page