Open rafapereirabr opened 2 years ago
This is a known limitation of data.table
. See #4415 for a discussion of why this occurs. The gist is the following: As you are aware bbox is stored as an attribute of geom and depends on the values of that vector. No data.table function ever touches these attributes. When you call subset()
it actually ends up falling back on the data.frame method which calls c()
which in turn recomputes the bbox. That's why it fixes it.
Sorry for the question: I also use data.table rbindlist to bind two multipolygon sf objects together. Does this mean the boundingbox of the new layer is always messed up after this and I have to run the subset command as a fix? Thank you!
I've found that
rbindlist{data.table}
somehow changes the bouding box of spatialsf
objects. This is related to issue #2273 here, and I've linked to issues on geobr and tmap packages as well.Minimal reproducible example
For some reason, though, this problem is fixed when I run a simple subset removing a row hat does not exist in the data.
sessionInfo()