The Screen Grid Layer takes in an array of latitude and longitude coordinated points, aggregates them into histogram bins and renders as a grid

add_screengrid(
map,
data = get_map_data(map),
lon = NULL,
lat = NULL,
polyline = NULL,
weight = NULL,
aggregation = c("sum", "mean", "min", "max"),
colour_range = NULL,
opacity = 0.8,
cell_size = 50,
layer_id = NULL,
update_view = TRUE,
focus_layer = FALSE,
digits = 6
)

## Arguments

map a mapdeck map object data to be used in the layer. All coordinates are expected to be EPSG:4326 (WGS 84) coordinate system column containing longitude values column containing latitude values optional column of data containing the polylines, if using encoded polylines the weight of each value. Default 1 one of 'min', 'mean', 'max', 'sum'. If supplied it specifies how the weights used. vector of 6 hex colours opacity of cells. Value between 0 and 1. Default 0.8 size of grid squares in pixels. Default 50 single value specifying an id for the layer. Use this value to distinguish between shape layers of the same type. Layers with the same id are likely to conflict and not plot correctly logical indicating if the map should update the bounds to include this layer logical indicating if the map should update the bounds to only include this layer number of digits for rounding coordinates

## Details

add_screengrid supports POINT and MULTIPOINT sf objects

## data

If the data is a simple feature object, the geometry column is automatically detected. If the sf object contains more than one geometry column and you want to use a specific one, you'll need to set the active geometry using sf::st_geometry( x ) <- "your_column" , where "your_column" is the name of the column you're activating. See ?sf::st_geometry

## Examples

# \donttest{

key <- 'abc'
set_token( key )

'https://raw.githubusercontent.com/uber-common/deck.gl-data/master/',
'examples/3d-heatmap/heatmap-data.csv'
))

df <- df[ !is.na(df$lng), ] df$weight <- sample(1:10, size = nrow(df), replace = T)

mapdeck( style = mapdeck_style('dark'), pitch = 45 ) %>%
data = df
, lat = "lat"
, lon = "lng"
, weight = "weight",
, layer_id = "screengrid_layer"
, cell_size = 10
, opacity = 0.3
)

## as an sf object
# }