Many questions seem similar to mine, I could not however find a fitting answer for R.
So far, I use the awesome R leaflet (and ggmap) package that way:
library(ggmap)
library(leaflet)
coord <-geocode('New York')
map.city <- leaflet() %>%
addTiles('http://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png?apikey=68c4cd328d3b484091812a76fae093fd') %>%
setView(coord$lon, coord$lat, zoom = 11)
But what if I want as a map the Google satellite?
I went through this post
https://stackoverflow.com/questions/9394190/leaflet-map-api-with-google-satellite-layer#=
but don't understand how to use the googleSat function defined there.
If it has to be google satellite imagery you could use the googleway package. If other satellite imagery is ok, you can use "Esri.WorlImagery" with or without "CartoDB.PositronOnlyLabels" in leaflet:
library(ggmap)
library(leaflet)
coord <-geocode('New York')
map.city <- leaflet() %>% addProviderTiles('Esri.WorldImagery') %>%
setView(coord$lon, coord$lat, zoom = 11)
map.city %>% addProviderTiles("CartoDB.PositronOnlyLabels")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With