Description Usage Arguments Value Note Author(s) See Also Examples
Query the server for map tiles, defined uniquely by their
X and Y ID and zoom. For offline usage, these map tiles are stored in a local directory
1 2 3 4 5 6 7 8 9 10 11 12 13 | GetMapTiles(center = c(lat = 52.431635, lon = 13.194773), lonR,
latR, nTiles = c(3, 3), zoom = 13, urlBase = c("http://a.tile.openstreetmap.org/",
"http://mt1.google.com/vt/lyrs=m")[1], CheckExistingFiles = TRUE,
TotalSleep = NULL, tileExt = ".png", tileDir = "~/mapTiles/OSM/",
returnTiles = FALSE, verbose = 0)
|
center |
optional center (lat first,lon second ) |
lonR |
longitude range |
latR |
latitude range |
nTiles |
number of tiles in x and y direction |
zoom |
Google maps zoom level. |
urlBase |
tileserver URL |
CheckExistingFiles |
logical, if TRUE check if files already exist and only download if not! |
TotalSleep |
overall time (in seconds) that one is willing to add in between downloads. This is intended to lower the risk of a server denial. If NULL no call to Sys.sleep is executed |
tileExt |
image type of tile |
tileDir |
map tiles are stored in a local directory |
returnTiles |
return tiles in a list? |
verbose |
level of verbosity |
list with important information
Note that size is in order (lon, lat)
Markus Loecher
GetMap.bbox
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | if (0){
tmp=GetMapTiles("World Trade Center, NY", zoom=15,nTiles = c(5,5), verbose=1)
PlotOnMapTiles(tmp)
tmp=GetMapTiles("World Trade Center, NY", zoom=16,nTiles = c(20,20), verbose=1)
tmp2=GetMapTiles("World Trade Center, NY", zoom=15,nTiles = c(5,5), verbose=1,
urlBase = "http://mt1.google.com/vt/lyrs=m",
tileDir= "~/mapTiles/Google/")
tmp=GetMapTiles("Hoboken, NJ", zoom=16,nTiles = c(30,30), verbose=1,
urlBase = "http://mt1.google.com/vt/lyrs=m",
tileDir= "~/mapTiles/Google/")
PlotOnMapTiles(tmp2)
tmp2=GetMapTiles("Werderscher Markt 15, 10117 Berlin", zoom=15,nTiles = c(20,20), verbose=0,
urlBase = "http://mt1.google.com/vt/lyrs=m",
tileDir= "~/mapTiles/Google/")
###combine with leaflet:
#From:http://stackoverflow.com/questions/5050851/
# best-lightweight-web-server-only-static-content-for-windows
#To use Python as a simple web server just change your working
#directory to the folder with your static content and type
#python -m SimpleHTTPServer 8000, everything in the directory
#will be available at http:/localhost:8000/
library(leaflet)
m = leaflet::leaflet() %>%
addTiles( urlTemplate = "http:/localhost:8000/mapTiles/OSM/{z}_{x}_{y}.png")
m = leaflet::leaflet() %>%
addTiles( urlTemplate = "http:/localhost:8000/mapTiles/Google/{z}_{x}_{y}.png")
m = m %>% leaflet::setView(-74.01312, 40.71180, zoom = 16)
m = m %>% leaflet::addMarkers(-74.01312, 40.71180)
#Quadriga:
m = m %>% leaflet::setView(13.39780, 52.51534, zoom = 16)
m = m %>% leaflet::addMarkers(13.39780, 52.51534)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.