coastline-class {oce} | R Documentation |
Class to store coastline data, with standard slots metadata
(containing fillable
and filename
), data
(containing
longitude
and latitude
) and processingLog
.
Positional data may be accessed as e.g.
coastline[["longitude"]]
or coastline[["latitude"]]
, with
abbreviations (e.g. coastline[["lo"]]
) being permitted so long
as they are distinct. However, metadata must be named in full.
Latitude may be changed with e.g.
coastline[["longitude"]] <- value
, and of course the same can be
done for latitude
.
The show
method (e.g.
show(coastline)
) displays information about the object.
The NOAA website
http://www.ngdc.noaa.gov/mgg/shorelines/shorelines.html is a popular
starting point for coastline data. One assumes the data have some sort of
authority, being provided by a national organization. Another source for
coastline data is http://www.naturalearthdata.com, which provides
world datasets in a variety of resolutions. Another advantage of the
Natural Earth is that it provides data not just for coastlines, but also
for rivers, lakes, glaciated areas, and place names. The oce
dataset
named coastlineWorld
came from Natural Earth.
The present package provides a
coarse-resolution world coastline in coastlineWorld
, and the
ocedata package provides two alternatives at world scale. It is
common for users to want to use other coastlines, but CRAN policies do not
allow packages with tens of megabytes of such data. Users should download
such data and store them in .rda
files with e.g., for a
shapefile-formate file is named "mycoastline.shp"
to be stored
in a directory named /data/coastlines
, one might do as
follows.
mycoastline <- oce::read.oce("mycoastline.shp") save(mycoastline, file="/data/coastlines/mycoastline.rda") tools::resaveRdaFiles("/data/coastlines/mycoastline.rda", compress="auto")
after which accessing the saved mycoastline
dataset is as simple as
writing
load("/data/coastlines/mycoastline.rda")
Note: it is important to save the coastline with a new name, to avoid
conflicts with coastlineWorld
in the present package, and
coastlineWorldMedium
and coastlineWorldFine
in the
ocedata package.
Dan Kelley
Use as.coastline
to convert data to this form,
read.coastline
to read data in various formats, and
plot.coastline
to plot coastlines.