Hugo
Hugo

Reputation: 507

Adding google tiles with R

I'm using the leafletpackage with R to generate interactive maps and I would like to use the Google Maps layer. However Google Maps are not available as an argument of the function addProviderTiles. How can I add these google layers with R ?

Thank you very much !

Upvotes: 6

Views: 5458

Answers (3)

tepedizzle
tepedizzle

Reputation: 468

Try this leaflet() %>% addTiles(urlTemplate = "https://mts1.google.com/vt/lyrs=s&hl=en&src=app&x={x}&y={y}&z={z}&s=G", attribution = 'Google')

Upvotes: 17

pavan
pavan

Reputation: 21

I too was searching for the same... As Roman replied, I am using the following as an alternative

leaflet(data = data) %>% addMarkers() %>% addTiles(group = "OSM(default)") %>% addProviderTiles("Esri.WorldImagery", group = "ESRI") %>% addProviderTiles("Stamen.Toner", group = "Stamen") %>% addLayersControl(baseGroup = c("OSM(default", "ESRI", "Stamen"))

Upvotes: 1

Roman Luštrik
Roman Luštrik

Reputation: 70653

You are looking for a base map of from Google maps. Currently leaflet supports OpenStreetMap, MapQuestOpen, Stamen, Esri and OpenWeatherMap. If you have access to extra mapping, you can use a WMS tile to serve your own cartography. No google maps, sorry.

Upvotes: 2

Related Questions