Description Usage Arguments Details Value Slots The GeoContainer class Using the class Extending the GeoContainer class See Also
An extension of the Container
class holding metadata and
two-dimensional point spatial data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | GeoContainer(x, ...)
## S4 method for signature 'missing'
GeoContainer(
x,
schema = Schema(),
xcol = character(),
ycol = character(),
crs = sp::CRS(),
...
)
## S4 method for signature 'character'
GeoContainer(
x,
schema = Schema(),
xcol = character(),
ycol = character(),
crs = sp::CRS(),
...
)
## S4 method for signature 'data.frame'
GeoContainer(
x,
schema = Schema(),
xcol = character(),
ycol = character(),
crs = sp::CRS(),
...
)
## S4 method for signature 'data.table'
GeoContainer(
x,
schema = Schema(),
xcol = character(),
ycol = character(),
crs = sp::CRS(),
...
)
## S4 method for signature 'Schema'
GeoContainer(
x,
schema = Schema(),
xcol = character(),
ycol = character(),
crs = sp::CRS(),
...
)
## S4 method for signature 'GeoContainer'
show(object)
|
x |
conceptually, any R object. Typically, a |
... |
further arguments passed to or from other methods:
|
schema |
a |
xcol |
a character of length 1 naming a field in |
ycol |
a character of length 1 naming a field in |
crs |
either an integer of length 1 or an object of class
|
object |
a |
Schema
to GeoContainer()
If a Schema
object is passed to GeoContainer()
, an empty
GeoContainer
is generated. It will have empty columns defined with names
and types matching the underlying Schema
. Argument schema
is ignored for that special case.
crs
argument of GeoContainer()
The integer must represent a valid EPSG code (a standardized index for the underlying coordinates reference system). It must hold be recognized by the PROJ.4 projection system. To learn more on EPSG codes (or to search for one), use the excellent online API epsg.io.
The constructor function GeoContainer()
returns an object of class
GeoContainer
.
The show()
method returns NULL
invisibly. It is used for its-effect.
table
a data.table
. Its structure must
match what slot schema
prescribes.
schema
a Schema
holding metadata (column names,
types and prototypes) on the structure of table
.'
xcol
a character. The name of the field in table
that holds x
(east-west) spatial coordinates.
ycol
a character. The name of the field in table
that holds y
(north-south) spatial coordinates.
crs
an object of class sp::CRS
holding spatial
coordinates' metadata. It must describe a valid Coordinates Reference
System (CRS).
Class GeoContainer
extends class Container
for point
data characterized by two-dimensional spatial coordinates. The added slots
hold relevent spatial metadata. The class leverage recognized R packages
sp and rgdal. Package cargo also includes some tools to
work with spatial data.
An object of class GeoContainer
also inherits class Container
.
This means that all features of the Container
class can be used with objects
of class GeoContainer
.
Create objects of class GeoContainer
through the constructor function GeoContainer()
.
Validate instances of the class by using valid_geocontainer()
.
Test objects for class GeoContainer
with introspector function is_geocontainer()
.
Extract slots from instances of the class with functions table()
,
schema()
, xcol()
, ycol()
and crs()
.
Extract spatial coordinates from instances of the class with function xy()
.
Set new values to slots with functions table<-()
,
schema<-()
, xcol<-()
, ycol<-()
and
crs<-()
.
Subset instances of the class by using the Container
methods
implemented for operators [
, [[
and $
.
Users should extend this class to a super-class with additional slots by
using package methods only if their intent is to work with spatial
data. Else, the Container
class should be extended
instead.
Other GeoContainer:
GeoContainer-accessors
,
GeoContainer-methods
,
GeoContainer-validators
,
is_geocontainer()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.