Sync shapes when dropping elements from table - #183
Conversation
| s <- shapes(x)[[i]] | ||
| # check which cells still exist | ||
| # FIXME: I kind of doubt this always has this name. Do we have an accessor for this??? | ||
| keep <- s[["__index_level_0__"]] %in% all_nms |
There was a problem hiding this comment.
Not ideal either, but I know it is sometimes i) missing, or ii) defined by instance_key of the table - maybe we can check for instance_key, and otherwise something like setdiff(names(s), c("radius", "geometry")? At least a little more robust, until we learn better...
|
Let me talk to Daria/Luca before proceeding. I believe in this particular case, the table is linked to a shape. Said shape, however, misses an instance_key altogether. The column you see should be called "cell_id" imo. I just want to avoid us fixing things when the object is invalid in the first place (not sure yet, but might be)... |
|
This has been addressed (see |
Former-commit-id: dfce8f8 Former-commit-id: dd815be4250550d75451a5a10b88bfd8a1962e9d
Former-commit-id: e6c5082395282c0df7a78a8800a8b49cdfa1fd64 Former-commit-id: dd815be4250550d75451a5a10b88bfd8a1962e9d
Currently, SpatialData includes utilities to drop elements from tables when removed from the other layers, but no utilities to drop elements from other layers when elements from tables are dropped.
This is a quick and dirty new
.sync_shapes_on_drop()function, modelled directly after.sync_tables_on_drop()to address a use case needed in demos.Eventually, the
sync...functions should probably be refactored and all cases should be covered, but this should solve the specific issue at hand.