GetOsmMap | R Documentation |
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.
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, ...)
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 |
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 |
verbose |
level of verbosity, |
... |
extra arguments to be used in future versions |
map structure or URL used to download the tile.
The OSM maptile server is frequently too busy to accomodate every request, so patience is warranted.
Markus Loecher
if (0) {
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()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.