[R-sig-Geo] gdistance: working with vector speed data in two direction
tf at devmag.net
tf at devmag.net
Thu Dec 8 11:11:59 CET 2011
Dear all,
I have the following problem.
I managed to use the gdistance package to give me computations for
shortest distances between two ocean points. I am working on a simple
1 degree grid for that and it works fine.
However, now I want to incorporate something slightly more advanced.
For each cell of the grid I have a wind vector with its horizontal and
its vertical wind component; the units are speeds in meters per
second, which can be positive / negative indicating the direction
north/ south, east and west.
I have both of them as a raster object.
Similar to the vignette hiking example, I want to compute the fastest
way to get from A to B. Imagine that the object that moves from A to B
is a sailing boat that wants to exploit the best possible combiantion
of winds along all possible paths from A to B.
The data structure for now is as follows:
vertical <- raster(nrows=10, ncols=10)
vertical <- setValues(vertical, runif(10*10, min=-1, max=1) )
horizontal <- raster(nrows=10, ncols=10)
horizontal <- setValues(horizontal, runif(10*10, min=-1, max=1) )
In the hiking example, the direction was either going up or going down
which was captured by the sign of the height difference (i.e. the
slope).
They key difference here is, that I essentially have "two signs" for
both speed direction components.
I am not sure whether this is possible using the gdistance package; I
would be happy to hear your thoughts and comments.
Best,
Thiemo
More information about the R-sig-Geo
mailing list