ol_geom_heatmap: OpenLayers Heatmap Layer

View source: R/layer_heatmap.R

ol_geom_heatmapR Documentation

OpenLayers Heatmap Layer

Description

Function to create a Heatmap layer to add to an OpenLayers Map object.

Usage

ol_geom_heatmap(point.obj, name = NULL, toggle.control = FALSE,
  gradient = NULL, opacity = 1, radius = 8, blur = 15,
  shadow = 250, weight.values = NULL)

Arguments

point.obj

SpatialPointsDataframe, SpatialPoints, or a matrix containing columns of point longitudes and latitudes, respectively.

name

character Layer name.

toggle.control

logical indicating whether this layer will have a visibility toggle.

gradient

character color gradient of heatmap. See OpenLayers Heatmap Documentation Enclose gradient array in single character string.

opacity

numeric Heatmap opacity. See OpenLayers Heatmap Documentation.

radius

numeric Heatmap radius size in pixels.See OpenLayers Heatmap Documentation.

blur

numeric Heatmap blur. See OpenLayers Heatmap Documentation.

shadow

numeric Heatmap shadow. See OpenLayers Heatmap Documentation.

weight.values

numeric vector of weights to be assigned to the points in point.obj. Values should be in [0,1].

Details

This function stores the data required to generate an OpenLayers vector layer with features using Point geometries. See OpenLayers Heatmap Documentation for details.

Value

A list object of class Layer.HeatMap.

Aesthetics

  • fill

  • size

See Also

ol_map, ol_geom_polygon, ol_geom_circle, ol_geom_point, ol_geom_icon

Examples

heatmap.pts <- matrix(
    c(
        rnorm(100,-80.385,1), #Miami Longitudes
        rnorm(100,-117.1611,3), #San Diego Longitudes
        rnorm(100,25.782618,1), #Miami Latitudes
        rnorm(100,32.7157,3) # San Diego Latitudes
    ),ncol=2
)
mymap <- ol_map(
    center=c(-98.5,28.5),
    zoom=4
) + 
    streetmap() +
    ol_geom_heatmap(
        heatmap.pts,
        name="Random Heatmap",
        toggle.control=TRUE,
        opacity=0.25
        )
## Not run: 
# Write to file and view in browser
ol_map2HTML(
  mymap,
  "heatmap.html",
  map.note="Heatmap of random points centered on Miami and San Diego."
)
browseURL("heatmap.html")

## End(Not run)

cemarks/ROpenLayers documentation built on March 31, 2022, 12:05 p.m.