Usage
read.coastline(file, type=c("R","S","mapgen","shapefile","openstreetmap"),
debug=getOption("oceDebug"), monitor=FALSE, processingLog)
read.coastline.shapefile(file, lonlim=c(-180,180), latlim=c(-90,90),
debug=getOption("oceDebug"), monitor=FALSE, processingLog)
read.coastline.openstreetmap(file, lonlim=c(-180,180), latlim=c(-90,90),
debug=getOption("oceDebug"), monitor=FALSE, processingLog)
Arguments
file
name of file containing coastline data.
type
type of file, one of "R"
, "S"
, "mapgen"
,
"shapefile"
or "openstreetmap"
.
debug
set to TRUE to print information about the header, etc.
latlim
range of (signed) latitudes, used only for shapefiles.
Regions that do not intersect this range are skipped.
lonlim
as latlim
, but a signed longitude.
monitor
print a dot for every coastline segment read (ignored
except for reading "shapefile" type)
processingLog
if provided, the action item to be stored in the
log. (Typically only provided for internal calls; the default that
it provides is better for normal calls by a user.)
A hack for depth contours
The following demonstrates that this code is getting close to working with
depth contours. But this should be handled more internally, and a new
object for depth contours should be constructed, of which coastlines could be a subset.
library(oce)
d <- read.coastline.shapefile("~/Dropbox/DepthContours/DepthContours.shp")
isna <- is.na(d[["latitude"]])
idx <- 1 + cumsum(isna)
lat <- split(d[["latitude"]][!isna], idx[!isna])
lon <- split(d[["longitude"]][!isna], idx[!isna])
depths <- d[["depths"]]
n <- length(depths)
D <- 200
plot(c(-180,180), c(-90,90), xlab="", ylab="", asp=1, type='n')
for (i in 1:n) {
if (depths[i]==D)
lines(lon[[i]], lat[[i]])
}