Westerschelde monitoring stations
## ============================================================================
## NIOZ westerschelde monitoring stations in google maps
## data are in OceanView, called niozWS
## implemented by Karline Soetaert
## ============================================================================
library(OceanView)
library(RgoogleMaps)
library(png)
# get googlemaps and plot it; create room for color key (mar)
destfile <- "WS.png"
MetaInfo <- GetMap(center = c(51.35, 3.97), zoom = 10,
maptype = "satellite", destfile = destfile)
par (mar = c(4, 4, 4, 6))
scatter2D(c(MetaInfo$BBOX$ll[2], MetaInfo$BBOX$ur[2]),
c(MetaInfo$BBOX$ll[1], MetaInfo$BBOX$ur[1]), type = "n",
xlab = expression(""^o~E), ylab = expression(""^o~N),
main = "Westerschelde monitoring stations",
xaxs = "i", yaxs = "i")
img <- as.raster(readPNG(destfile))
rasterImage(img, xleft = MetaInfo$BBOX$ll[2], ybottom = MetaInfo$BBOX$ll[1],
xright = MetaInfo$BBOX$ur[2], ytop = MetaInfo$BBOX$ur[1])
# station position, and mean salinity
stpos <- unique(data.frame(WSnioz$Station, WSnioz$Latitude, WSnioz$Longitude))
sal <- sapply(stpos[,1], FUN = function(x) mean(WSnioz$DataValue[WSnioz$Station == x
& as.character(WSnioz$VariableName) == "WCSALIN" ], na.rm = TRUE))
# plot it
scatter2D(stpos[,3], stpos[,2], colvar = sal, pch = 18, cex = 3,
col = jet2.col(100), add = TRUE, NAcol = "transparent",
clab = "psu", colkey = list(width =0.5, length = 0.5, dist = 0.1))
text2D(stpos[,3], stpos[,2], lab = stpos[,1], add = TRUE, cex = 0.75,
font = 2)
scatter2D(stpos[,3], stpos[,2], colvar = sal, pch = 18, cex = 3,
col = jet2.col(100), add = TRUE, NAcol = "transparent",
clab = "psu", colkey = list(width =0.5, length = 0.5, dist = 0.1))
text2D(stpos[,3], stpos[,2], lab = stpos[,1], add = TRUE, cex = 0.75,
font = 2)
Go back