GetOsmMap: Query the Open Street Map server for map tiles instead of...

Description Usage Arguments Value Note Author(s) Examples

Description

The querying parameters for Open Street Maps are somewhat different in this version.

Instead of a zoom, center and size, the user supplies a scale parameter and a lat/lon bounding box.

The scale determines the image size.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
GetOsmMap(lonR = c(-74.02132, -73.98622), latR = c(40.69983, 


    40.72595), scale = 20000, destfile = "MyTile.png", format = "png", 


    RETURNIMAGE = TRUE, GRAYSCALE = FALSE, NEWMAP = TRUE, verbose = 1, 


    ...)

Arguments

lonR

longitude range

latR

latitude range

scale

Open Street map scale parameter. The larger this value, the smaller the resulting map tile in memory. There is a balance to be struck between the lat/lon bounding box and the scale parameter.

destfile

File to load the map image from or save to, depending on NEWMAP.

format

(optional) defines the format of the resulting image.

RETURNIMAGE

return image yes/no default: TRUE

GRAYSCALE

Boolean toggle; if TRUE the colored map tile is rendered into a black & white image, see RGB2GRAY

NEWMAP

if TRUE, query the Google server and save to destfile, if FALSE load from destfile.

verbose

level of verbosity,

...

extra arguments to be used in future versions

Value

map structure or URL used to download the tile.

Note

The OSM maptile server is frequently too busy to accomodate every request, so patience is warranted.

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


 	CologneMap <- GetOsmMap(lonR= c(6.89, 7.09), latR = c(50.87, 51), scale = 150000, 


                            destfile = "Cologne.png");


	PlotOnStaticMap(CologneMap, mar=rep(4,4), NEWMAP = FALSE, TrueProj = FALSE, axes= TRUE);


		


	PrincetonMap <- GetOsmMap(lonR= c(-74.67102, -74.63943), latR = c(40.33804,40.3556), 


                             scale = 12500, destfile = "Princeton.png");


	png("PrincetonWithAxes.png", 1004, 732)


      PlotOnStaticMap(PrincetonMap, axes = TRUE, mar = rep(4,4));


    dev.off()


 }

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