SplitMap Control with transparent layers
See original GitHub issueThe SplitMap Control does not work properly for transparent layers. For example, when adding a WMS layer with transparency (i.e., NoData area is transparent), there is a background basemap on the left blocking the layer on the right. There is still a gray background on the left even when the basemap is cleared. Ideally, the left layer with transparency would be directly overlaid on the right layer without being interfered by the basemap or gray background.
from ipyleaflet import Map, basemaps, basemap_to_tiles, SplitMapControl, WMSLayer
m = Map(center=(40, -100), zoom=4)
m.clear_layers()
right_layer = basemap_to_tiles(basemaps.NASAGIBS.ModisTerraTrueColorCR, "2017-11-11")
# left_layer = basemap_to_tiles(basemaps.NASAGIBS.ModisAquaBands721CR, "2017-11-11")
naip_url = 'https://services.nationalmap.gov/arcgis/services/USGSNAIPImagery/ImageServer/WMSServer?'
left_layer = WMSLayer(url=naip_url, layers='0', name='NAIP Imagery', format='image/png')
control = SplitMapControl(left_layer=left_layer, right_layer=right_layer)
m.add_control(control)
m
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
103 split control - geemap
The split-panel map requires two layers: left_layer and right_layer . ... fmt="image/png", transparent=True, ) right_layer = folium.
Read more >49 split control - leafmap
The split-panel map requires two layers: left_layer and right_layer . The layer instance can be a string representing a basemap, or an HTTP...
Read more >SplitMap Control — ipyleaflet documentation - Read the Docs
SplitMapControl class, with Control as parent class. A control which allows comparing layers by splitting the map in two. ... The left layer(s)...
Read more >QuantStack/leaflet-splitmap - GitHub
Creates a new Leaflet Control for comparing two layers or collections of layers. It does not add the layers to the map -...
Read more >Creating a transparent portion of a control to see controls ...
In Windows Forms, you achieve transparency (or draw irregularly shaped windows) by defining a region. To quote MSDN.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@martinRenou Thanks to your suggestion. I was able to make it work. Note that the script below is only a portion of a much longer Earth Engine script. Therefore, you won’t be able to run it directly.
Ok now I understand. So the code that should do what you want is:
But again, it does not work and lots of errors are appearing.
It looks like this works: