# NOT RUN {
data(WY)
samp <- sdraw(WY, 100, type="HIP", J=c(4,3))
plotSample( samp, WY )
plotSample( samp, WY, lattice=TRUE )
# A map-like background under frame and sample ----
# Requires 'OpenStreetMap' package and internet connection
# }
# NOT RUN {
library(OpenStreetMap)
# 1:convert to Lat-Long
WY.ll <- spTransform(WY, CRS("+init=epsg:4326"))
# 2:Specify bounding box for OpenStreetMap
bb.openmap <- bbox(WY.ll)
ULcoords <- c(bb.openmap[2,2], bb.openmap[1,1])
BRcoords <- c(bb.openmap[2,1], bb.openmap[1,2])
# 3:Fetch image (see 'openmap' help for 'type' parameter)
openMap <- OpenStreetMap::openmap(ULcoords, BRcoords, type = "esri")
# 4:Project background image to original coordinate system
openMap <- OpenStreetMap::openproj(openMap, projection = CRS(proj4string(WY)))
# 5:plot background
plot(openMap)
# 6:plot frame and sample
plotSample(samp, WY, add=TRUE, poly.fill=FALSE)
# }
Run the code above in your browser using DataLab