mapview icon indicating copy to clipboard operation
mapview copied to clipboard

[feature-idea]: zcol count parameter

Open sonicseamus opened this issue 1 year ago • 1 comments

I often have datasets where I would like to visualize the number of occurrences of my zcol variable ("name" in this example), e.g.

Geometry name
(1, 1) "a"
(1, 2) "b"
(1, 3) "c"
(1, 4) "d"
(1, 3) "c"
(1, 1) "a"

and what I want displayed by mapview is really the summarized dataframe:

Geometry name count
(1, 1) "a" 2
(1, 2) "b" 1
(1, 3) "c" 2
(1, 4) "d" 1

where the new "count" column is the one visualized on a scale with zcol. However, it should still display the "name" column when I mouse over the data points for ease of identification.

I could accomplish something close to this by using mapview(df |> dplyr::count(name), zcol = "n", label = "name"), but it might be more intuitive if it could be implemented as a one-step function within the mapview call, perhaps something like mapview(df, zcol = "name", count = TRUE).

sonicseamus avatar Nov 20 '24 16:11 sonicseamus

I don't think that fits the scope of mapview. You'd need to create that count object/dataframe yourself before mapviewing it. Otherwise, where will this end? We could also have a e.g. frequency argument and so on... Or am I misunderstanding your request?

tim-salabim avatar Nov 20 '24 16:11 tim-salabim