1\name{GetMap.bbox} 2 3\alias{GetMap.bbox} 4 5\title{GetMap bbox} 6 7\description{Wrapper function for \link{GetMap}. Query the Google server for a static map tile, defined primarily by its lat/lon range and/or center and/or zoom. 8 9Multiple additional arguments allow the user to customize the map tile.} 10 11\usage{GetMap.bbox(lonR, latR, center, size = c(640, 640), 12 13 destfile = "MyTile.png", MINIMUMSIZE = FALSE, RETURNIMAGE = TRUE, 14 15 GRAYSCALE = FALSE, NEWMAP = TRUE, zoom, verbose = 0, 16 17 SCALE = 1, type = c("google", "google-m", "google-s", 18 19 "osm", "osm-hot", "stamen-toner", "stamen-terrain", 20 21 "stamen-watercolor")[1], urlBase = "http://mt1.google.com/vt/lyrs=m", 22 23 tileDir = "/tmp/", ...)} 24 25\arguments{ 26 27 \item{lonR}{longitude range} 28 29 \item{latR}{latitude range} 30 31 \item{center}{optional center} 32 33 \item{size}{desired size of the map tile image. defaults to maximum size returned by the Gogle server, which is 640x640 pixels} 34 35 \item{destfile}{File to load the map image from or save to, depending on \code{NEWMAP}.} 36 37 \item{MINIMUMSIZE}{reduce the size of the map to its minimum size that still fits the lat/lon ranges ?} 38 39 \item{RETURNIMAGE}{return image yes/no default: TRUE} 40 41 \item{GRAYSCALE}{Boolean toggle; if TRUE the colored map tile is rendered into a black & white image, see \link{RGB2GRAY}} 42 43 \item{NEWMAP}{if TRUE, query the Google server and save to \code{destfile}, if FALSE load from destfile.} 44 45 \item{zoom}{Google maps zoom level. optional} 46 47 \item{verbose}{level of verbosity} 48 49 \item{SCALE}{use the API's scale parameter to return higher-resolution map images. The scale value is multiplied with the size to determine the actual output size of the image in pixels, without changing the coverage area of the map} 50 51 \item{type}{choice of tile server} 52 53 \item{urlBase}{tileserver URL, alternatives would be "http://a.tile.openstreetmap.org/", "http://tile.stamen.com/toner/","http://tile.stamen.com/watercolor/"} 54 55 \item{tileDir}{map tiles can be stored in a local directory, e.g. "~/mapTiles/Google/"} 56 57 \item{\dots}{extra arguments to \link{GetMap}} 58 59} 60 61 62 63\value{map tile} 64 65 66 67\author{Markus Loecher} 68 69 70 71 72 73 74 75 76 77\examples{ 78 79 if (0){ 80 81 mymarkers <- cbind.data.frame(lat = c(38.898648,38.889112, 38.880940), 82 83 lon = c(-77.037692, -77.050273, -77.03660), size = c('tiny','tiny','tiny'), 84 85 col = c('blue', 'green', 'red'), char = c('','','')); 86 87 88 89 ##get the bounding box: 90 91 bb <- qbbox(lat = mymarkers[,"lat"], lon = mymarkers[,"lon"]); 92 93 94 95 ##download the map: 96 97 MyMap <- GetMap.bbox(bb$lonR, bb$latR, destfile = "DC.png", GRAYSCALE =TRUE, 98 99 markers = mymarkers); 100 101 ##The function qbbox() basically computes a bounding box for the given lat,lon 102 103 #points with a few additional options such as quantile boxes, additional buffers, etc. 104 105 bb <- qbbox(c(40.702147,40.711614,40.718217),c(-74.015794,-74.012318,-73.998284), 106 107 TYPE = "all", margin = list(m=rep(5,4), TYPE = c("perc", "abs")[1])); 108 109 ##download the map: 110 111 MyMap <- GetMap.bbox(bb$lonR, bb$latR,destfile = "MyTile3.png", maptype = "satellite") 112 113 114 115} 116 117} 118 119