[R-sig-Geo] Add popup coordinates to marker in leaflet
Manuel Spínola
m@p|no|@10 @end|ng |rom gm@||@com
Wed Jun 1 20:40:13 CEST 2022
Thank you very much Zivan.
El mié, 1 jun 2022 a las 11:46, Zivan Karaman (<zivan.karaman using gmail.com>)
escribió:
> 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 using 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 using una.cr <mspinola using una.ac.cr>
>> mspinola10 using 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 using r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
--
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
mspinola using una.cr <mspinola using una.ac.cr>
mspinola10 using 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]]
More information about the R-sig-Geo
mailing list