Skip to content
Prev 28966 / 29559 Next

Add popup coordinates to marker in leaflet

Hi,

You could try something like this:

library(leaflet)
library(htmltools)

df <- read.csv(textConnection(
    "Name,Lat,Long
    Samurai Noodle,47.597131,-122.327298
    Kukai Ramen,47.6154,-122.327157
    Tsukushinbo,47.59987,-122.326726"
    ))

leaflet(df) %>% addTiles() %>%
    addMarkers(~Long, ~Lat, popup = ~htmlEscape(paste(Name, Lat, Long)))

Hope this helps.
Zivan
On Wed, Jun 1, 2022 at 6:22 PM Manuel Sp?nola <mspinola10 at gmail.com> wrote: