ericpante / marmap

Import, plot and analyze bathymetric and topographic data
32 stars 7 forks source link

least-cost path and distance among antimeridian sites #4

Closed makayana closed 7 years ago

makayana commented 7 years ago

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.

ericpante commented 7 years ago

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

makayana commented 7 years ago

Thanks Eric! Sorry for my stupid mistakes. It now works.