Skip to content

Commit

Permalink
fix: improve error handling for vector of coordinates out of bound
Browse files Browse the repository at this point in the history
fix #110

[ci skip]
  • Loading branch information
rCarto committed Oct 13, 2022
1 parent 279a044 commit 6a63afd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ input_route <- function(x, id, single = TRUE, all.ids = FALSE){
if(single){
if(is.vector(x)){
if(length(x) == 2 & is.numeric(x)){
if(x[1] > 180 | x[1] < -180 | x[2] > 90 | x[2] < -90){
stop(paste0("longitude is bounded by the interval [-180, 180], ",
"latitude is bounded by the interval [-90, 90]"),
call. = FALSE)
}
lon <- clean_coord(x[1])
lat <- clean_coord(x[2])
return(list(id = id, lon = lon, lat = lat, oprj = oprj))
Expand Down

0 comments on commit 6a63afd

Please sign in to comment.