Skip to content

Instantly share code, notes, and snippets.

@walkerke
Created February 19, 2015 19:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save walkerke/12a737c4d87aca2ecc70 to your computer and use it in GitHub Desktop.
Save walkerke/12a737c4d87aca2ecc70 to your computer and use it in GitHub Desktop.
library(leaflet)
## OSM
leaflet() %>%
setView(-97.3606922, 32.7084083, zoom = 16) %>%
addTiles()
## OSM black-and-white
leaflet() %>%
setView(-97.3606922, 32.7084083, zoom = 16) %>%
addTiles(urlTemplate = "http://{s}.tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png",
attribution = '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>')
## Stamen watercolor
leaflet() %>%
setView(-97.3606922, 32.7084083, zoom = 16) %>%
addTiles(urlTemplate = 'http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.png',
attribution = 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> &mdash; Map data &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>')
## Esri National Geographic
leaflet() %>%
setView(-97.3606922, 32.7084083, zoom = 16) %>%
addTiles(urlTemplate = 'http://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}',
attribution = 'Tiles &copy; Esri &mdash; National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC')
## Your custom MapBox tiles - insert your map id as directed
leaflet() %>%
setView(-97.3606922, 32.7084083, zoom = 16) %>%
addTiles(urlTemplate = "http://a.tiles.mapbox.com/v3/{{{Your map id here}}}/{z}/{x}/{y}.png",
attribution = 'Mapbox <a href="http://mapbox.com/about/maps" target="_blank">Terms &amp; Feedback</a>')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment