class_geocontainer: GeoContainer: a container for point spatial data

Description Usage Arguments Details Value Slots The GeoContainer class Using the class Extending the GeoContainer class See Also

Description

An extension of the Container class holding metadata and two-dimensional point spatial data.

Usage

 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)

Arguments

x

conceptually, any R object. Typically, a character, a data.frame, a data.table or a Schema. See details. If missing, an empty object is initialized.

...

further arguments passed to or from other methods:

  • if x is a character, ... is passed to safe_read_csv();

  • if x is a data.frame or an object of class Schema, ... is passed to data.table::as.data.table().

schema

a Schema object. If x is itself an object of class Schema, it should be missing (it is ignored).

xcol

a character of length 1 naming a field in x that holds (east-west) spatial coordinates.

ycol

a character of length 1 naming a field in x that holds (north-south) spatial coordinates.

crs

either an integer of length 1 or an object of class sp::CRS. Passing an integer to this argument triggers an implicit conversion, see Details.

object

a GeoContainer object.

Details

Passing objects of class 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.

Passing integer values to the 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.

Value

The constructor function GeoContainer() returns an object of class GeoContainer.

The show() method returns NULL invisibly. It is used for its-effect.

Slots

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).

The GeoContainer class

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.

Using the class

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.

Extending the GeoContainer class

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.

See Also

Other GeoContainer: GeoContainer-accessors, GeoContainer-methods, GeoContainer-validators, is_geocontainer()


jeanmathieupotvin/cargo documentation built on Oct. 27, 2020, 5:22 p.m.