Open smalers opened 3 years ago
The InfoMapper is using HTML 5 canvas, which I think uses "alpha" (transparency), whereas Leaflet uses opacity. These are opposite of each other. See the following to convert. It is pretty simple. Hopefully this solves the issue. It might require some additional scaling if dealing with values 0-255.
https://stackoverflow.com/questions/60956245/transparency-to-opacity-conversion
After spending some time messing around with the above formula, I'm still confused why I'm getting drastically different opacities on the map. Here is a screenshot of the map when using the original code with no changes:
Honestly they both look spot on to me, but I can clearly see a difference between them in the picture from the comment above, so I'm not sure what I should do. Changing the opacity or transparency of either of them using the formula will change the opacity to resemble the problematics image from Steve. Unless both of these images seem off/wrong and it's a monitor issue?
I tried to fix the issue where raster map shows lines at the edges of pixels, perhaps due to Leaflet overlaying the edges on adjoining cells and somehow combining the colors to result in darker colors. I set the width of the line to zero, as follows. I also tried -1 for width with same result. I don't know if there is a way to specify "no color" (not the same as white) for outline color but such a special value might help.
This does not fix the issue, although it may improve in some cases. However, this points out that the colors used in the legend are not matching those in the map layer. The colors in the legend are too light. I also tried to try different background layers to see if that impacted the color.
Unfortunately, after trying different background layers, the raster failed to draw, although it seemed to perhaps be drawing behind the background layer, based on watching the refresh. Selecting the Top USGS layer caused this issue and since it is the last layer maybe there is logic that is not properly handling the size of layer array?