get_googlemap()
queries the Google Maps Static API version 2 to download
a static map. Note that in most cases by using this function you are
agreeing to the Google Maps API Terms of Service at
https://cloud.google.com/maps-platform/terms/. Note that as of mid-2018,
registering with Google Cloud to obtain an API key is required to use any of
Google's services, including get_googlemap()
. Usage and billing may apply,
see the links under See Also further down in this documentation for more
details.
Usage
get_googlemap(
center = c(lon = -95.3632715, lat = 29.7632836),
zoom = 10,
size = c(640, 640),
scale = 2,
format = c("png8", "gif", "jpg", "jpg-baseline", "png32"),
maptype = GOOGLE_VALID_MAP_TYPES,
language = "en-EN",
messaging = FALSE,
urlonly = FALSE,
filename = NULL,
color = c("color", "bw"),
force = FALSE,
where = tempdir(),
archiving = FALSE,
ext = "com",
inject = "",
region,
markers,
path,
visible,
style,
...
)
Arguments
- center
the center of the map; either a longitude/latitude numeric vector or a string containing a location, in which case
geocode()
is called withsource = "google"
. (default:c(lon = -95.3632715, lat = 29.7632836)
, a reference to Houston, Texas)- zoom
map zoom; an integer from 3 (continent) to 21 (building), default value 10 (city)
- size
rectangular dimensions of map in pixels - horizontal x vertical - with a max of c(640, 640). this parameter is affected in a multiplicative way by scale.
- scale
multiplicative factor for the number of pixels returned possible values are 1, 2, or 4 (e.g. size = c(640,640) and scale = 2 returns an image with 1280x1280 pixels). 4 is reserved for google business users only. scale also affects the size of labels as well.
- format
character string providing image format - png, jpeg, and gif formats available in various flavors
- maptype
character string providing google map theme. options available are
"terrain"
,"satellite"
,"roadmap"
, and"hybrid"
- language
character string providing language of map labels (for themes with them) in the format
"en-EN"
. not all languages are supported; for those which aren't the default language is used- messaging
turn messaging on/off
- urlonly
return url only
- filename
destination file for download (file extension added according to format). Default
NULL
means a randomtempfile()
.- color
color or black-and-white
- force
if the map is on file, should a new map be looked up?
- where
where should the file drawer be located (without terminating "/")
- archiving
use archived maps. note: by changing to TRUE you agree to the one of the approved uses listed in the Google Maps API Terms of Service : https://cloud.google.com/maps-platform/terms/.
- ext
domain extension (e.g.
"com"
,"co.nz"
)- inject
character string to add to the url
- region
borders to display as a region code specified as a two-character ccTLD ("top-level domain") value, see https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains
- markers
data.frame with first column longitude, second column latitude, for which google markers should be embedded in the map image, or character string to be passed directly to api
- path
data.frame (or list of data.frames) with first column longitude, second column latitude, for which a single path should be embedded in the map image, or character string to be passed directly to api
- visible
a location as a longitude/latitude numeric vector (or data frame with first column longitude, second latitude) or vector of character string addresses which should be visible in map extent
- style
character string to be supplied directly to the api for the style argument or a named vector (see examples). this is a powerful complex specification, see https://developers.google.com/maps/documentation/maps-static/
- ...
...
See also
https://developers.google.com/maps/documentation/maps-static/overview/,
https://developers.google.com/maps/documentation/maps-static/start/,
https://developers.google.com/maps/documentation/maps-static/get-api-key/,
https://developers.google.com/maps/documentation/maps-static/usage-and-billing/,
ggmap()
, register_google()
Author
David Kahle david@kahle.io