0

I used the code mentioned in other topics here:

link <- c("https://lh4.googleusercontent.com/4okYLMcxk2ZjRqWwSwU8WkEcRQA4NRYxYrlZjieGCace9oNl2DYC78-ZsfIUxu2GKh2_SoPOWluXll2Sl5P0uJxCDPFW_uzQqsW_oHOQ9ept44Ex87I0yw_5EhD6nR1aIRiM")

addCircleMarkers(lng = ~ X, lat = ~ Y, radius = 3, fillColor = ~ species_5,
               stroke = F, fillOpacity = 0.5,
               popup = paste0("<img src='", link, "' />")

But image doesn't appear in the popup window. Since this image is uploaded from KML file, the link doesnt have ".jpg" part. You can check link. How to refer to that with aim to show image in the popup? Thanks

1 Answers1

0

Providing a reproducible example would make it easier to solve your issue. Here's one that works for me:

library(leaflet)
data(quakes)

link <- "https://lh4.googleusercontent.com/4okYLMcxk2ZjRqWwSwU8WkEcRQA4NRYxYrlZjieGCace9oNl2DYC78-ZsfIUxu2GKh2_SoPOWluXll2Sl5P0uJxCDPFW_uzQqsW_oHOQ9ept44Ex87I0yw_5EhD6nR1aIRiM"

leaflet(data = quakes[1:20,]) %>% addTiles() %>%
  addMarkers(~long, ~lat, label = ~as.character(mag), popup = paste0("<img src = ", link, " />"))

enter image description here

Phil
  • 7,287
  • 3
  • 36
  • 66
  • Seems to be good, and I reproduced this code. Actually, it is the same to my code. And now I realized that it is just something in my R Viewer or something else since it is not shown again :( – Maksym Matsala Aug 10 '19 at 17:58