Whereas EMPTY geometries are a concept at the geometry level,
missing values are a concept of the in-memory vectors used to store
them in R. The geo_is_missing() function can be used to identify
these values, similar to is.na(). Missing coordinates (NA or NaN)
can be identified using geo_has_missing(), and geo_is_finite()
can be used to ensure that all coordinates are finite. Note that
geo_xy(NA, NA), wkt("POINT (nan nan)"), and
wkt("MULTIPOINT (nan nan)") are all considered empty points,
and are therefore non-misssing, contain no missing coordinates, and
are finite (use is.na() and/or stringr::str_detect()) if you
would like to specifically detect these cases).
geo_is_missing(x) geo_has_missing(x) geo_is_finite(x) geo_is_empty(x) NA_wkt_ NA_wkb_ NA_collection_ NA_xy_ NA_segment_ NA_rect_
| x | A geometry-like object, or one that can be
coerced to a geometry-like object using |
|---|
An object of class wk_wkt (inherits from wk_vctr) of length 1.
An object of class wk_wkb (inherits from wk_vctr) of length 1.
An object of class NULL of length 0.
An object of class geovctrs_xy (inherits from vctrs_rcrd, vctrs_vctr) of length 1.
An object of class geovctrs_segment (inherits from vctrs_rcrd, vctrs_vctr) of length 1.
An object of class geovctrs_rect (inherits from vctrs_rcrd, vctrs_vctr) of length 1.
A logical vector
geo_is_missing(NA_wkt_)#> [1] TRUEgeo_has_missing(NA_wkt_)#> [1] NAgeo_is_finite(NA_wkt_)#> [1] NAgeo_is_empty(NA_wkt_)#> [1] TRUE#> [1] FALSE#> [1] TRUE#> [1] FALSE#> [1] FALSE#> [1] FALSE#> [1] FALSE#> [1] FALSE#> [1] FALSE#> [1] FALSE#> [1] FALSE#> [1] TRUE#> [1] TRUE# POINT EMPTY, POINT (nan nan), and geo_xy(NA, NA) # are all empty points geo_is_missing(wkt("POINT EMPTY"))#> [1] FALSE#> [1] FALSE#> [1] TRUE#> [1] TRUE#> [1] FALSE#> [1] TRUE#> [1] FALSE#> [1] FALSE#> [1] TRUE#> [1] TRUE#> [1] FALSE#> [1] TRUE