[R-sig-Geo] gdistance::shortestPath throws error "not a symmetric matrix"

Daniel Knitter knitter at geographie.uni-kiel.de
Tue Feb 6 16:42:25 CET 2018


Hi Loris,

Tobler is an asymmetric function [as long as you used this one: function(s){6 * exp(-3.5 * abs(s + 0.05))} 

Did you create a symmetric transition object by calling 

"transition(InputRaster, TransitionFuncion, Neighborhood, symm=TRUE)"

This would explain the warning, because you need to set "symm=FALSE". symm=TRUE is only needed for random walks (i.e. passage function).

Cheers,
Daniel

On Tue, 06 Feb 2018 16:28:16 +0100
"Loris Bennett" <loris.bennett at fu-berlin.de> wrote:

> Hi,
> 
> Before I try to construct a reproducible example, which would probably
> be quite time consuming, I wondered if this is a known problem.  I am
> calling 'shortestPath' thus
> 
> 
>   shortestPath(conduct_Tobler,
>                origin = sites at coords[1,],
>                goal = sites at coords[2,],
>                output="SpatialLines")
> 
> and get the error
> 
>   Error in asMethod(object) :
>     not a symmetric matrix; consider forceSymmetric() or symmpart()
> 
> with the following traceback:
> 
>   pairlist("stop(\"not a symmetric matrix; consider forceSymmetric() or
>   symmpart()\")",
>     "asMethod(object)",
>     "as(Laplacian,\"symmetricMatrix\")",
>     ".Laplacian(x)", ".flowMap(x, ci, cj, tc)",
>     ".local(x, origin, goal, ...)",
>   c("passage(conduct_Tobler, origin =sites at coords[5, ], goal =
>   sites at coords[3, ", " ])"),
>   c("passage(conduct_Tobler, origin = sites at coords[5, ], goal =
>   sites at coords[3, ", " ])"),
>     "eval(ei, envir)", "eval(ei, envir)",
>     "withVisible(eval(ei, envir))",
>     "source(\"./Skript.R\")")
> 
> However, a shape file is produced.
> 
> Any ideas what the problem might be?
> 
> Cheers,
> 
> Loris
> 
> --
> Dr. Loris Bennett (Mr.)
> ZEDAT, Freie Universität Berlin         Email loris.bennett at fu-berlin.de
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo


-- 

Dr. Daniel Knitter
CRC1266 -- Scales of Transformation
Project A2 "Integrative Modeling of Socio-Environmental Dynamics"

Christian-Albrechts-Universität zu Kiel
Department of Geography
Physical Geography -- Landscape Ecology and Geoinformation
Ludewig-Meyn-Str. 14, room 109
D - 24118 Kiel, Germany

Phone: +49 431 880 2941
Email: knitter at geographie.uni-kiel.de

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20180206/7c04dbd3/attachment.sig>


More information about the R-sig-Geo mailing list