mapview (version 1.2.0)

popupImage: Create HTML strings for popup graphs

Description

Create HTML strings for popup graphs used as input for mapview or leaflet.

Usage

popupImage(img, src = c("local", "remote"), ...)

Arguments

img
A character vector of file path(s) or web-URL(s) to any sort of image file(s).
src
Whether the source is "local" (i.e. valid file path(s)) or "remote" (i.e. valid URL(s)).
...
width and height (in pixels) can be passed to underlying functions.

Value

A list of HTML strings required to create popup graphs.

See Also

popupTable and popupGraph.

Examples

Run this code
## Not run: 
# ## remote images -----
# ### one image
# pt <- data.frame(x = 174.764474, y = -36.877245)
# coordinates(pt) <- ~ x + y
# proj4string(pt) <- "+init=epsg:4326"
# 
# img <- "http://bit.ly/1TVwRiR"
# 
# mapview(pt, popup = popupImage(img, src = "remote"))
# 
# ### multiple file (types)
# images <- c(img,
#             "https://upload.wikimedia.org/wikipedia/commons/1/1b/R_logo.svg",
#             "https://www.r-project.org/logo/Rlogo.png",
#             "https://upload.wikimedia.org/wikipedia/commons/d/d6/MeanMonthlyP.gif")
# 
# pt4 <- data.frame(x = jitter(rep(174.764474, 4), factor = 0.01),
#                   y = jitter(rep(-36.877245, 4), factor = 0.01))
# coordinates(pt4) <- ~ x + y
# proj4string(pt4) <- "+init=epsg:4326"
# 
# mapview(pt4, popup = popupImage(images, src = "remote")) # NOTE the gif animation
# 
# ## local images -----
# img <- system.file("img","Rlogo.png",package="png")
# mapview(pt, popup = popupImage(img))
# ## End(Not run)

Run the code above in your browser using DataLab