[R-sig-Geo] Inconsistent null geometry handling in sf and terra

Barry Rowlingson b@row||ng@on @end|ng |rom gm@||@com
Fri Apr 15 18:11:33 CEST 2022


The `sf` package returns the extent of a null geometry as "NA", wheras
terra's `vect` returns an object with an extent of (-180,180, -90,+90).
`sf` also prints a warning.

This came from a gis stack Q:
https://gis.stackexchange.com/questions/428925/sfst-read-and-terravect-reading-in-different-extents-from-the-same-shape/428983?noredirect=1#comment699839_428983
which has link to sample data and code.

There's a few questions remaining which might be worth discussing here
before deciding if any package needs an issue/bugfix:

1. what does the SF standard say about the extent of a Null geometric
feature?
2. what does the SF standard say about the extent of a collection of
features, if one of them is Null? The `sf` package returns the extent of
the non-null features, but there's maybe an argument for saying "if I don't
know the extent of feature 23, I don't know the extent of any data frame
with feature 23 in it" (by analogy with NA+1+2+3 => NA)
3. should warnings be printed when null geometries occur (terra::vect
doesn't do this, st_read does).


Barry

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list