geom-class: Geometry class (S4) and methods

geom-classR Documentation

Geometry class (S4) and methods

Description

A geom stores a table of points, a table of feature to which the points are associated and a table of groups, to which features are associated. A geom can be spatial (if it has a coordinate reference system assigned to it), but is not by default.

Arguments

window

data.frame(2)
in case the reference window deviates from the bounding box of crds, specify here the minimum and maximum values in columns x and y.

Details

A geom has one of three geometry types:

  • "point", when none of the points are connected to other points,

  • "line", where points with the same fid are connected following the sequence of their order, without the line closing in itself and

  • "polygon", where points with the same fid are connected following the sequence of their order and the line closes in on itself due to first and last point being the same. Moreover, polygon objects can contain holes.

The data model for storing points follows the spaghetti model. Points are stored as a sequence of x and y values, associated to a feature ID. The feature ID relates coordinates to features and thus common attributes. Points and Lines are implemented straightforward in this model, but polygons, which may contain holes, are a bit trickier. In geometr they are implemented as follows:

  1. All points with the same fid make up one polygon, irrespective of it containing holes or not.

  2. The outer path/ring of a polygon is composed of all points until a duplicated of its first point occurs. This signals that all following points are part of another path/ring, which must be inside the outer path and which consists of all points until a duplicate of it's first point occurs.

  3. This repeats until all points of the feature are processed.

Moreover, a geom has a reference window, which is sort of a second extent that may be bigger (or smaller) than the extent and which determines the relative position of the points when plotting.

Slots

type

character(1)
the type of feature, either "point", "line", "polygon" or "grid".

geometry

data.frame(3)
the fid (feature ID), x and y coordinates per point and optional arbitrary point attributes.

data

named list
A list with the layer name and list elements $features and $groups containing the features and groups of that layer.

  • features: fid (feature ID), gid (group ID) and optional arbitrary feature attributes.

  • groups: gid (group ID) and optional arbitrary group attributes.

crs

character(1)
the coordinate reference system in proj4 notation.

provenance

list(.)
a list of steps taken to derive the geom in focus.


EhrmannS/geometr documentation built on Jan. 31, 2024, 9:13 a.m.