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

Albin Blaschka albin.blaschka at standortsanalyse.net
Mon Dec 9 14:51:09 CET 2013


Hello!

I had the same problem and took the following approximation:

I had a DEM and calculated the slope in a GIS. Then, I took the 
resulting raster and trigonometric functions:

if your raster resolution / cell size is 20m, then the "surface 
distance" is

20/cos(slope)

Caveat: R ist calculating cosinus in radians, if you have degrees you 
have to convert it:

1 Degree = 0.017453292519943 rad

I read the slope raster into R, calculated this approximation and wrote 
a new raster file with this "surface distance"...

It is an approximation, as the distance is only valid either in strict 
x- or y- direction, but for my use (and raster resolution) this is ok 
and a certain rasterization is given if you use a rester dataset...

Hope this helps!
Albin






Am 06.12.2013 19:56, schrieb Barry Rowlingson:
> 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!
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
| Albin Blaschka, Mag.rer.nat.
| Etrichstrasse 26, A-5020 Salzburg
| * www.albinblaschka.info *
| * www.researchgate.net/profile/Albin_Blaschka *
| - It's hard to live in the mountains, hard but not hopeless!



More information about the R-sig-Geo mailing list