View source: R/layer_heatmap.R
| ol_geom_heatmap | R Documentation |
Function to create a Heatmap layer to add to an OpenLayers Map object.
ol_geom_heatmap(point.obj, name = NULL, toggle.control = FALSE, gradient = NULL, opacity = 1, radius = 8, blur = 15, shadow = 250, weight.values = NULL)
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 |
This function stores the data required to generate an OpenLayers
vector layer with features using Point
geometries.
See OpenLayers Heatmap Documentation
for details.
A list object of class Layer.HeatMap.
fill
size
ol_map,
ol_geom_polygon,
ol_geom_circle,
ol_geom_point,
ol_geom_icon
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.