| 1 |
\name{sp} |
| 2 |
|
| 3 |
\alias{sp} |
| 4 |
|
| 5 |
\title{A package providing classes and methods for spatial data: points, |
| 6 |
lines, polygons and grids } |
| 7 |
|
| 8 |
|
| 9 |
\description{ |
| 10 |
This package provides S4 classes for importing, manipulating and exporting |
| 11 |
spatial data in R, and for methods including print/show, plot, subset, |
| 12 |
\code{[}, \code{[[}, \code{\$}, names, dim, summary, and a number of |
| 13 |
methods specific to spatial data handling. |
| 14 |
|
| 15 |
}%description |
| 16 |
|
| 17 |
|
| 18 |
\section{Introduction}{ |
| 19 |
Several spatial statistical packages have been around for a long while, |
| 20 |
but no organized set of classes for spatial data has yet been devised. |
| 21 |
Many of the spatial packages make their own assumptions, or use their |
| 22 |
own class definitions for spatial data, making it inconvenient to move |
| 23 |
from one package to another. This package tries to provide a solid set |
| 24 |
of classes for many different types of spatial data. The idea is that |
| 25 |
spatial statistical packages will either support these classes (i.e., |
| 26 |
directly read and write them) or will provide conversion to them, so that |
| 27 |
we have a base class set with which any package can exchange. This way, |
| 28 |
many-to-many conversions can be replace with one-to-many conversions, |
| 29 |
provided either in this package or the spatial packages. Wherever possible |
| 30 |
conversion (coercion) functions are automatic, or provided by sp. |
| 31 |
|
| 32 |
External packages that depend on sp will provide importing and exporting |
| 33 |
from and to external GIS formats, e.g. through GDAL, OGR or shapelib. |
| 34 |
|
| 35 |
In addition, this package tries to provide convenient methods to print, |
| 36 |
summarize and plot such spatial data. |
| 37 |
|
| 38 |
}%section{Introduction} |
| 39 |
|
| 40 |
\section{Dimensions}{ |
| 41 |
In principal, geographical data are two-dimensional, on a flat surface (a |
| 42 |
map) or on a sphere (the earth). This package provides space for dealing |
| 43 |
with higher dimensional data where possible; this is e.g. very simple |
| 44 |
for points and grids, but hard to do for polygons. Plotting functions |
| 45 |
are devised primarily for two-dimensional data, or two-dimensional |
| 46 |
projections of higher dimensional data. |
| 47 |
}%section{Dimensions} |
| 48 |
|
| 49 |
\section{Coordinate reference systems}{ |
| 50 |
Central to spatial data is that they have a coordinate reference system, |
| 51 |
which is coded in object of CRS class. Central to operations on different |
| 52 |
spatial data sets is that their coordinate reference system is compatible |
| 53 |
(i.e., identical). |
| 54 |
|
| 55 |
This CRS can be a character string describing a reference system in |
| 56 |
a way understood by the PROJ.4 projection library, or a (character) |
| 57 |
missing value. An interface to the PROJ.4 library is available only if |
| 58 |
the R package rgdal is present. |
| 59 |
} |
| 60 |
|
| 61 |
\section{Class structure}{ |
| 62 |
All spatial classes derive from a basic class \code{Spatial}, which only |
| 63 |
provides a bounding box and a CRS. This class has no useful instances, but |
| 64 |
useful derived classes. |
| 65 |
|
| 66 |
SpatialPoints extends Spatial and has coordinates. The method |
| 67 |
\link{coordinates} extracts the numeric matrix with coordinates from an |
| 68 |
object of class SpatialPoints, or from other (possibly derived) classes |
| 69 |
that have points. |
| 70 |
|
| 71 |
Objects of class SpatialGrid points on a regular grid. Either a full grid |
| 72 |
is stored or a partial grid (i.e., only the non-missing valued cells); |
| 73 |
calling \link{coordinates} on them will give the coordinates for the |
| 74 |
grid cells. |
| 75 |
|
| 76 |
SpatialPoints, SpatialPixels and SpatialGrid can be of arbitrary |
| 77 |
dimension, although most of the effort is in making them work for two |
| 78 |
dimensional data. |
| 79 |
|
| 80 |
SpatialLines provides lines, and SpatialPolygons provides polygons, i.e., |
| 81 |
lines that end where they start and do not intersect with itself. |
| 82 |
SpatialLines and SpatialPolygons only have two-dimensional data. |
| 83 |
|
| 84 |
SpatialPointsDataFrame extends SpatialPoints with a data slot, having |
| 85 |
a data.frame with attribute data. Similarly, SpatialPixelsDataFrame, |
| 86 |
SpatialLinesDataFrame, SpatialPolygonsDataFrame extend the primary |
| 87 |
spatial information with attribute data. |
| 88 |
|
| 89 |
} |
| 90 |
|
| 91 |
\section{References}{ |
| 92 |
PROJ.4: \url{https://github.com/OSGeo/PROJ} |
| 93 |
|
| 94 |
GDAL and OGR: \url{https://gdal.org/}. |
| 95 |
} |
| 96 |
|
| 97 |
\section{Authors}{ |
| 98 |
sp is a collaborative effort of Edzer Pebesma, Roger Bivand, Barry |
| 99 |
Rowlingson and Virgilo G\'omez-Rubio. |
| 100 |
} |
| 101 |
|
| 102 |
\keyword{spatial} |