luukvdmeer / sfnetworks

Tidy Geospatial Networks in R
https://luukvdmeer.github.io/sfnetworks/
Other
347 stars 20 forks source link

Allow to summarise attributes in to_spatial_smooth #120

Closed luukvdmeer closed 2 years ago

luukvdmeer commented 3 years ago

Is your feature request related to a problem? Please describe. In the new release of sfnetworks, the to_spatial_contracted morpher (which merges nodes) and the to_spatial_simple morpher (which merges edges) have the argument summarise_attributes which allows you to specify on a per-attribute basis how the attribute values of a new, merged feature should be inferred from the original features. There is one more morpher currently that merges features: to_spatial_smooth merges edges after removing pseudo nodes. It would be nice when the summarise_attributes argument is also implemented there.

However: the implementation of this argument in the contraction and simplification was quite easy, since igraph provides it and it only had to be forwarded to igraph::contract and igraph::simplify respectively. The smooth functionality however is self-implemented and does not use existing igraph functions (as far as I know igraph does not have a function for removing pseudo nodes). This will make it more complicated to add the argument.

Describe the solution you'd like A summarise_attributes argument in to_spatial_smooth.

luukvdmeer commented 2 years ago

See also #179 and #181 having the same feature request.

luukvdmeer commented 2 years ago

Implemented in v0.6.0, see https://luukvdmeer.github.io/sfnetworks/articles/sfn02_preprocess_clean.html#smooth-pseudo-nodes