Create HTML strings for popup graphs

Share:

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## 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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.