plotmap: easy to use wrapper function

Description Usage Arguments Author(s) Examples

Description

note the similarity in name to PBSmapping::plotMap

This function is the workhorse of the package RgoogleMaps. It overlays plot on background image of map tile.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
plotmap(lat, lon, map, zoom = NULL, API = c("google", "OSM", 


    "bing", "google2")[1], maptype = c("roadmap", "mobile", "satellite", 


    "terrain", "hybrid", "mapmaker-roadmap", "mapmaker-hybrid")[2], 


    destfile, data, alpha = 1, col = 1, apiKey = NULL, verbose = 0, 


    ...)

Arguments

lat

latitude values to be overlaid OR string to be geocoded!

lon

longitude values to be overlaid

map

optional map object

zoom

Google maps zoom level

API

choice of map tile API

maptype

defines the type of map to construct. There are several possible maptype values, including satellite, terrain, hybrid, and mobile.

destfile

File to save the map image to

data

data to look up variables in

alpha

opacity

col

plot color

apiKey

optional API key (allows for higher rate of downloads for Google); mandatory for Bing maps

verbose

level of verbosity

...

further arguments to be passed to PlotOnStaticMap

Author(s)

Markus Loecher

Examples

 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
if (0){


  #####################Google maps#############################


  mapBG1 = plotmap("Brandenburg Gate, Berlin", zoom = 15)





  #####################bing maps#############################


  


  #for bing maps you will need your own API key, 


  #sign up at https://msdn.microsoft.com/en-us/library/ff428642.aspx


  apiKey = scan("C:/Users/loecherm/Dropbox/stuff/bingAPIkey.txt",what="")


  mapBG2 = plotmap("Brandenburg Gate, Berlin", zoom = 15, API = "bing", apiKey=apiKey)


  


  latlon <- cbind.data.frame(lat = c(38.898648,38.889112, 38.880940), 


                              lon = c(-77.037692, -77.050273, -77.03660));


  


  


  map3 = plotmap(lat = latlon$lat, lon = latlon$lon, API = "bing", apiKey=apiKey,


                 col = "purple", pch="X",cex=1.5)


  


  


  #####################OSM maps#############################


  map4 = plotmap(lat = latlon$lat, lon = latlon$lon, API = "OSM", zoom=15,


                 col = "purple", pch="X",cex=1.5)


}

RgoogleMaps documentation built on May 2, 2019, 5:03 p.m.