Thanks to visit codestin.com
Credit goes to github.com

Skip to content

addPolyline() with SpatVector fails if terra is not loaded because check_crs_terra() is missing depency terra::crs #893

@mkoohafkan

Description

@mkoohafkan

When {terra} is not loaded (e.g., individual {terra} functions are imported into package namespace) functions that internally call check_crs_terra() will fail. I think this is because check_crs_terra() simply calls crs() instead of terra::crs():

check_crs_terra <- function(x) {
crs <- crs(x)
# Don't have enough information to check
if (is.na(crs) || (crs==""))
return()
if (identical(terra::is.lonlat(x), FALSE)) {
warning("SpatVector layer is not long-lat data", call. = FALSE)
}
prj <- crs(x, proj=TRUE)
if (!grepl("+datum=WGS84", prj, fixed = TRUE)) {
warning(
"SpatVector layer has inconsistent datum (", prj, ").\n",
"Need '+proj=longlat +datum=WGS84'",
call. = FALSE
)
}
}

I encounter this issue when calling addPolylines() with SpatVector objects.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions