mapview icon indicating copy to clipboard operation
mapview copied to clipboard

(add feature) : provide a 'group' argument to generate multiple layers with vectors

Open ErvanCH opened this issue 5 years ago • 2 comments

I was thinking about a way to specify a column serving as grouping factor to generate multiple layers with vectors. Currently, the combination of burstand zcoldoes the following:

library(mapview)
data(breweries)
BRE <- subset(breweries,!is.na(number.of.types))
BRE$group <- cut(BRE$number.of.types,quantile(BRE$number.of.types,seq(0,1,0.25)),include.lowest=T,labels=c("low","medium","high","top"))
mapview(BRE,zcol="group",burst=T)

image

Currently, it is not possible to generate different layers based on 'group' and color features based on a different variable/column. A possible way is to create a list of vector/sf object (similar to a rasterStack), as follow:

BRElist <- split(BRE,f=BRE[["group"]])
mapview(BRElist,zcol=rep("number.of.types",length(BRElist)))

image Would be nice to have a wrapper doing the same on a row, e.g. mapview(BRE,zcol="number.of.types",groups (or layers) = "group", ....)

ErvanCH avatar Mar 03 '20 13:03 ErvanCH

Thanks! Not sure when I can get to this. Thinking this might also be a good issue/featre request for our dev day at useR2020! in St. Louis (in July)

tim-salabim avatar Mar 03 '20 13:03 tim-salabim

This feature would be awesome

GitHunter0 avatar Aug 15 '22 22:08 GitHunter0