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.
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:
All points with the same fid
make up one
polygon, irrespective of it containing holes or not.
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.
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.
type
[character(1)
]
the type of feature, either
"point"
, "line"
, "polygon"
or "grid"
.
point
[data.frame(1)
]
the fid
(feature ID), x
and y
coordinates per point and optional arbitrary point attributes.
feature
[data.frame(1)
]
fid
(feature ID), gid
(group ID) and optional arbitrary feature attributes.
group
[data.frame(1)
]
gid
(group ID) and optional
arbitrary group attributes.
window
[data.frame(1)
]
the minimum and maximum value in x and
y dimension of the reference window in which the geom
dwells.
scale
[character(1)
]
whether the point coordinates are stored
as "absolute"
values, or "relative"
to window
.
crs
[character(1)
]
the coordinate reference system in proj4
notation.
history
[list(.)
]
a list of steps taken to derive the
geom
in focus.