Learn R Programming

geostatsp (version 0.4.4)

openmap: Get map from a server

Description

This function is a wrapper for the openmap function in the openmap package, where the limits can be passed as a bounding box or an Extent.

Usage

openmap(upperLeft,  ...)
	## S3 method for class 'matrix':
openmap(upperLeft,...)
	## S3 method for class 'Extent':
openmap(upperLeft,...)

Arguments

upperLeft
A bounding box from a SpatialPoints or SpatialPolygons object or an Extent from a Raster. The name 'upperLeft' is retained for compatibility with openmap, but this argument specifies a
...
additional arguments, see openmap in the OpenStreetMap package.

Value

  • an object of class OpenStreetMap, in a lat-long projection.

Examples

Run this code
myraster = raster(matrix(0,10,10),xmn=0,xmx=10,ymn=0,ymx=10)

plot(myraster)

# only do the following if the the OpenStreetMap.org web site can be accessed
#if(length(nsl("www.OpenStreetMap.org"))) {
	mytiles = openmap(myraster@extent, zoom=4,  type="osm")

	plot(myraster)
	plot(mytiles, add=TRUE)

#	mypoints = SpatialPoints(10*cbind(runif(10), runif(20)))

#	mytiles=openmap(mypoints@bbox, zoom=4,  type="bing")

#	plot(mypoints)
#	plot(mytiles,add=T)
#	points(mypoints, col='yellow')
#}

Run the code above in your browser using DataLab