Here is a leaflet map in R
https://lawsblog.netlify.com/post/leaflet-map/
The white lines are neighbourhood boundaries. The green polygons are parks. The parks are drawn over the boundaries obscuring the borders. I want the white neighbourhood boundaries to be drawn on top of the parks so that the entire border is seen.
This sounds like an issue of layer ordering.
I thought I could use zIndex with leaflet to solve the problem. I've tried hoods = 200, parks = 300 and hoods = 200, parks = 100. I can't get it to work.
The relevant code:
# Add neighbourhoods
addPolygons(data = hood_shp,
fillColor = ~pal(be_per_cap),
weight = 2,
opacity = 1,
color = "white",
dashArray = "0",
fillOpacity = 1.0,
options = list(zIndex = 200) %>%
# Add parks
addPolygons(data = parks,
color = "green",
weight = 1.0,
opacity = 1.0,
options = list(zIndex = 300),
fillOpacity = 1.0)