I am using the
sf package to create new spatial datasets, via the
st_sf() function. I do not understand the use of the attribute-geometry relationship argument of this function. The help file specifies that it defines how each non-geometry field relates to the geometry field, and takes one of three values for each row: "constant", "aggregate", or "identity". There is also a value for unknown.
Here is what I can understand from the help file:
"constant" is used for attributes that are constant throughout the geometry (e.g. land use)
For a polygon or a line, this indicates that whatever the attribute is describing does not change inside the feature, such as (per the example) a homogeneous polygon of land use.
"aggregate" where the attribute is an aggregate value over the geometry (e.g. population density or population count)
From what I can tell from the example, this is used when the attribute is calculated from the geometry itself. Area and perimeter in the
sf example are classified as 'aggregate' attributes.
"identity" when the attributes uniquely identifies the geometry of particular "thing", such as a building ID or a city name
And with respect to "identity", I cannot find a salient example of this being different from "constant".
To test this, I loaded
demo(nc) and tried various combinations of
agr values. Changing the values randomly had no impact on the
class of the fields, their values, or how they behaved when summarized.
Can someone please explain why this argument exists, and how (or if) I should be using it when creating features?