Open
Description
In checkCoord
, lines 31-35:
ids.no.coord <- x[, orig.coord] %in% "no_coord"
if (any(ids.no.coord))
geo.check[ids.no.coord] <- "no_cannot_check"
tmp <- x[is.na(geo.check), ]
tmp <- sf::st_as_sf(tmp, coords = c(lon, lat))
There will be cases where orig.coord %in% coord_original
and also have no lat/lon coordinates (i.e., the gazetteer did not return any coordinates for the register). This type of register should also be considered "no_cannot_check", otherwise sf::st_as_sf(tmp, coords = c(lon, lat))
will return an error:
Error in st_as_sf.data.frame(tmp, coords = c(lon, lat)) :
missing values in coordinates not allowed
Maybe this can be solved using the argument na.fail = FALSE
inside sf::st_as_sf
but it doesn't seem right in my mind. It is better to add these cases as no_cannot_check
too.
This can be done adding this condition to x[, orig.coord] %in% "no_coord"
# Adding the OR condition for cases where origin.coord is coord_original
# but the lon OR lat are still NA even after using the gazetteer.
# These ones need to be no_cannot_check too
ids.no.coord <- x[, orig.coord] %in% "no_coord" |
(x[, orig.coord] %in% "coord_original" & (is.na(x[lon]) | is.na(x[lat])))
Metadata
Metadata
Assignees
Labels
No labels