Learn R Programming

oce (version 0.9-20)

download.coastline: Download a coastline File

Description

Constructs a query to the NaturalEarth server [1] to download coastline data (or lake data, river data, etc) in any of three resolutions.

Usage

download.coastline(resolution, item = "coastline", destdir = ".", destfile, server = "naturalearth", debug = getOption("oceDebug"))

Arguments

resolution
A character value specifying the desired resolution. The permitted choices are "10m" (for 1:10M resolution, the most detailed), "50m" (for 1:50M resolution) and "110m" (for 1:110M resolution). If resolution is not supplied, "50m" will be used.
item
A character value indicating the quantity to be downloaded. This is normally one of "coastline", "land", "ocean", "rivers_lakes_centerlines", or "lakes", but the NaturalEarth server has other types, and advanced users can discover their names by inspecting the URLs of links on the NaturalEarth site, and use them for item. If item is not supplied, it defaults to "coastline".
destdir
Optional string indicating the directory in which to store downloaded files. If not supplied, "." is used, i.e. the data file is stored in the present working directory.
destfile
Optional string indicating the name of the file. If not supplied, the file name is constructed from the other parameters of the function call, so subsequent calls with the same parameters will yield the same result, thus providing the key to the caching scheme.
server
A character value specifying the server that is to suppply the data. At the moment, the only permitted value is "naturalearth", which is the default if server is not supplied.
debug
an integer specifying whether debugging information is to be printed during the processing. This is a general parameter that is used by many oce functions. Generally, setting debug=0 turns off the printing, while higher values suggest that more information be printed.

Value

A character value indicating the filename of the result; if there is a problem of any kind, the result will be the empty string.

Warning

All of the download.* functions are subject to change through the autumn of 2016. The plan is to create individual functions as needs arise in everyday work, thereby discovering patterns of arguments that might make sense more generally. Therefore, it is likely that argument order (and even name) may change up until approximately December 2016. Users are advised to refer to arguments by name, i.e. not to rely on their order, and they are asked for patience, because argument names and defaults may vary through the early development.

References

1. The NaturalEarth server is at http://www.naturalearthdata.com

See Also

The work is done with download.file.

Other functions that download files: download.amsr, download.topo

Other things related to coastline data: [[,coastline-method, [[<-,coastline-method, as.coastline, coastline-class, coastlineBest, coastlineCut, coastlineWorld, plot,coastline-method, read.coastline.openstreetmap, read.coastline.shapefile, subset,coastline-method, summary,coastline-method

Examples

Run this code
## Not run: 
# library(oce)
# # User must create directory ~/data/coastline first.
# # As of September 2016, the downloaded file, named
# # "ne_50m_coastline.zip", occupies 443K bytes.
# filename <- download.coastline(destdir="~/data/coastline")
# coastline <- read.coastline(filename)
# plot(coastline)
# ## End(Not run)

Run the code above in your browser using DataLab