least-cost path and distance among antimeridian sites
Closed this issue · 2 comments
Hi,
I m wondering if there's any way to calculate the least-cost path and distance among antimeridian sites.
Using the aleutians data I made a transition matrix:
trans2<-trans.mat(aleutians)
And made up the following test coordinates:
test
x y
1 177 60
2 180 50
3 200 40
Then running lc.dist gave the following:
out2 <- lc.dist(trans2, test, res="path")
|=================== | 33%
Error in if (is.numeric(v) && any(v < 0)) { :
missing value where TRUE/FALSE needed
Running with just the first two sites are fine.
Hi Makayana,
I think that, in the particular example you provided, the problem comes from the fact that your last site falls outside of the aleutians map range:
summary(aleutians)
Latitudinal range: 50 to 65 (50 N to 65 N)
Longitudinal range: 165 to 215 (165 E to 145 W)
Cheers, eric
Thanks Eric! Sorry for my stupid mistakes. It now works.