I came across a problem when I was trying to visualize polygons using Simple Features
and Mapview
.
I've created two rectangles, a
and b
and put them on Mapview
on two layers. My problem is that if I select b
before a
, the b
rectangle will be covered by a
and will not be properly shown.
Is there any way I could always keep a
in the background, so that b
is always shown when selected?
library(mapview)
library(sf)
a<-rbind(c(0,0), c(15, 0), c(15, 5), c(0, 5), c(0, 0))
a_polygon<-st_polygon(list(a))
b<-rbind(c(5,1), c(10, 1), c(10, 4), c(5, 4), c(5, 1))
b_polygon<-st_polygon(list(b))
mapview(list(st_sfc(a_polygon), st_sfc(b_polygon)), col.regions = list('blue', 'yellow'), layer.name =c('a', 'b'))