[R-sig-Geo] Taking elevation into account when calculating distance

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Fri Dec 6 19:56:50 CET 2013


On Fri, Dec 6, 2013 at 3:49 PM, John Tellat <john.tellat at gmail.com> wrote:

> But it gives me 0.15m, which is not really the expected distance ...

 I get:

 > costDistance(tr1, cc)
           A
 B 0.01137836

But I'm not sure this is the right thing to do. The transition matrix
cost-distance approach only works on the cell level, so the distance
from the bottom left corner of your lower cell to the to right point
of your upper cell will be the same as from the two corners nearest
each other in that cell. (I think).

What's the distance from the bottom to the top of the stairs in my
house? For me its Pythagoras, sqrt(dx^2 + dy^2), but for a spider its
dx+dy - it has to crawl across every tread and up every riser.

 At first I thought the problem could be solved by taking the profile
of the path between the start and end points and taking the length of
that, but you have to sample the profile at a resolution, and if you
use a fine resolution you get the "spider" result and if you use a
large resolution you get the "human" result.

 You'll maybe get a better answer if you can treat your raster as a
continuous smooth surface, then the length of the profile should be
stable as you increase the resolution and not tend to dx+dy. But the
fundamental problem is that your raster is a discrete model of a
continuous reality [1] so any distances are going to be
approximations...

 This must be a GIS research question with some literature behind it...

Barry

[1] okay, lets argue if reality is continuous, discrete, fractal or
quantum string soup some other time!



More information about the R-sig-Geo mailing list