You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the recent update! It really brings some great new features. One feature I have been exploiting is map pane definition to control layer order in a map, e.g. points always on top of polygons.
This works great:
library(leaflet)
library(mapview) # for the data
leaflet() %>%
addTiles() %>%
addPolygons(data=franconia,
group="polygons",
opacity=1,
fillOpacity=1,
options= leafletOptions(pane="tilePane")) %>%
addCircleMarkers(data=breweries,
group="points",
color="black",
fillColor="black",
options= leafletOptions(pane="overlayPane")) %>%
addLayersControl(overlayGroups= c("polygons", "points"))
However, this does not work for addRasterImage (throughing error unused argument (options = leafletOptions(pane = "overlayPane"))).
If I understand correctly, addRasterImage uses L.GridLayer for the image rendering which has an option to specify the pane.
It would be great of we could add an options argument to addRasterImage so we can define which pane it should be rendered in. There are situations where you'd want an image to overlay vector features.
Related to this, we have freshly implemented a method to create custom map panes in a leaflet map following this tutorial. The relevant js code is here and the R functions are here.
I think this is general enough to have this in leaflet rather than mapview and I am more than happy to migrate this over for the next CRAN release (until then, I'd prefer to keep it in mapview, where it will be part of the next CRAN release).
Let me know if you are interested in migrating this to leaflet.
For completeness, here is where we specify the panes for use in mapview such that by default points overlay lines overlay polygons.
Thanks again for the great work you've put into leaflet recently!!
The text was updated successfully, but these errors were encountered:
Thanks for the recent update! It really brings some great new features. One feature I have been exploiting is map pane definition to control layer order in a map, e.g. points always on top of polygons.
This works great:
However, this does not work for
addRasterImage
(throughing errorunused argument (options = leafletOptions(pane = "overlayPane"))
).If I understand correctly,
addRasterImage
usesL.GridLayer
for the image rendering which has an option to specify the pane.It would be great of we could add an
options
argument toaddRasterImage
so we can define which pane it should be rendered in. There are situations where you'd want an image to overlay vector features.Related to this, we have freshly implemented a method to create custom map panes in a leaflet map following this tutorial. The relevant js code is here and the R functions are here.
I think this is general enough to have this in leaflet rather than mapview and I am more than happy to migrate this over for the next CRAN release (until then, I'd prefer to keep it in mapview, where it will be part of the next CRAN release).
Let me know if you are interested in migrating this to leaflet.
For completeness, here is where we specify the panes for use in mapview such that by default points overlay lines overlay polygons.
Thanks again for the great work you've put into leaflet recently!!
The text was updated successfully, but these errors were encountered: