trafficonese / leaflet.extras

Extra functionality for leaflet R package.
https://trafficonese.github.io/leaflet.extras/
GNU General Public License v3.0
211 stars 74 forks source link

ControlGPS not working in RStudio #206

Open bonushenricus opened 3 years ago

bonushenricus commented 3 years ago

Thanks a lot for the package. I am trying with

map<-leaflet()%>% addControlGPS(options = gpsOptions(position = "topleft", activate = T, autoCenter = T, maxZoom = 10, setView = F))

activateGPS(map)

but in the resulting map, on the crosshair button it tells me

Geolocation error. User denied geolocation prompt

Thank you

trafficonese commented 5 months ago

It seems to work in Shiny but not in RStudio..

library(shiny)  
library(leaflet)
library(leaflet.extras)

ui <- fluidPage(leafletOutput("map"))

server <- function(input, output, session) {
  output$map <- renderLeaflet({
    leaflet() %>% 
      addTiles() %>% 
      addControlGPS(options = gpsOptions(position = "topleft", activate = T, autoCenter = T,  maxZoom = 10, setView = F)) %>% 
      activateGPS()
  })
}
shinyApp(ui, server)