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:
Dear list members, How can I add the coordinates to the popup of the marker? library(leaflet) leaflet(m) %>% addTiles() %>% fitBounds(0, 40, 10, 50) %>% setView(-93.65, 42.0285, zoom = 17) %>% addMarkers(-93.65, 42.0285) -- *Manuel Sp?nola, Ph.D.* Instituto Internacional en Conservaci?n y Manejo de Vida Silvestre Universidad Nacional Apartado 1350-3000 Heredia COSTA RICA mspinola at una.cr <mspinola at una.ac.cr> mspinola10 at gmail.com Tel?fono: (506) 8706 - 4662 Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/index.php/manuel> Blog sobre Ciencia de Datos: https://mspinola-ciencia-de-datos.netlify.app [[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo