Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ContourLines2SLDF

Converter functions to build SpatialLinesDataFrame objects


Description

These functions show how to build converters to SpatialLinesDataFrame objects: ArcObj2SLDF from the list returned by the get.arcdata function in the RArcInfo package; ContourLines2SLDF from the list returned by the contourLines function in the graphics package (here the data frame is just the contour levels, with one Lines object made up of at least one Line object per level); and MapGen2SL reads a file in "Mapgen" format into a SpatialLines object.

Usage

ArcObj2SLDF(arc, proj4string=CRS(as.character(NA)), IDs)
ContourLines2SLDF(cL, proj4string=CRS(as.character(NA)))
MapGen2SL(file, proj4string=CRS(as.character(NA)))

Arguments

arc

a list returned by the get.arcdata function in the RArcInfo package

IDs

vector of unique character identifiers; if not given, suitable defaults will be used, and the same values inserted as data slot row names

cL

a list returned by the contourLines function in the graphics package

proj4string

Object of class "CRS"; see CRS-class

file

filename of a file containing a Mapgen line data set

Value

A SpatialLinesDataFrame object

Note

Coastlines of varying resolution may be chosen online and downloaded in "Mapgen" text format from https://www.ngdc.noaa.gov/mgg/shorelines/shorelines.html, most conveniently using the interactive selection tool, but please note the 500,000 point limit on downloads, which is easy to exceed.

Author(s)

Roger Bivand; Edzer Pebesma

See Also

Examples

#data(co37_d90_arc) # retrieved as: 
# library(RArcInfo)
# fl <- "http://www.census.gov/geo/cob/bdy/co/co90e00/co37_d90_e00.zip"
# download.file(fl, "co37_d90_e00.zip")
# e00 <- zip.file.extract("co37_d90.e00", "co37_d90_e00.zip")
# e00toavc(e00, "ncar")
# arc <- get.arcdata(".", "ncar")
#res <- arcobj2SLDF(arc)
#plot(res)
#invisible(title(""))
res <- ContourLines2SLDF(contourLines(volcano))
plot(res, col=terrain.colors(nrow(as(res, "data.frame"))))
title("Volcano contours as SpatialLines")

maptools

Tools for Handling Spatial Objects

v1.1-1
GPL (>= 2)
Authors
Roger Bivand [cre, aut] (<https://orcid.org/0000-0003-2392-6140>), Nicholas Lewin-Koh [aut], Edzer Pebesma [ctb], Eric Archer [ctb], Adrian Baddeley [ctb], Nick Bearman [ctb], Hans-Jörg Bibiko [ctb], Steven Brey [ctb], Jonathan Callahan [ctb], German Carrillo [ctb], Stéphane Dray [ctb], David Forrest [ctb], Michael Friendly [ctb], Patrick Giraudoux [ctb], Duncan Golicher [ctb], Virgilio Gómez Rubio [ctb], Patrick Hausmann [ctb], Karl Ove Hufthammer [ctb], Thomas Jagger [ctb], Kent Johnson [ctb], Matthew Lewis [ctb] (<https://orcid.org/0000-0003-2244-4078>), Sebastian Luque [ctb], Don MacQueen [ctb], Andrew Niccolai [ctb], Edzer Pebesma [ctb], Oscar Perpiñán Lamigueiro [ctb], Ethan Plunkett [ctb], Ege Rubak [ctb] (<https://orcid.org/0000-0002-6675-533X>), Tom Short [ctb], Greg Snow [ctb], Ben Stabler [ctb], Murray Stokely [ctb], Rolf Turner [ctb]
Initial release
2021-03-14

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.