[R-sig-Geo] Step characteristics on raster maps

Robert J. Hijmans r.hijmans at gmail.com
Thu Sep 30 17:28:55 CEST 2010


Perhaps you can do something like

r is a Raster* object
line is a SpatialLines* object

library(raster)
rr <- linesToRaster(line, r)
rm <- mask(r, rr)
crosstab(rm, rr)

Robert

On Thu, Sep 30, 2010 at 5:46 AM, Mathieu Basille
<basille at ase-research.org> wrote:
> Dear list members,
>
> I'm trying to compute characteristics along steps (i.e. segments between two
> points), based on underlying raster maps. The steps originally come from
> radiotracking data, converted to ltraj objects (adehabitat). The idea is to
> compute (for example) the habitat composition corresponding to each step
> instead of each points, as we are interesting in the movement path.
>
> I tried different solutions, as I would like to do it with R. I did not find
> any solution using adehabitat (or the development versions adehabitatMA/LS);
> 'join' only works for point characteristics, not steps. I also tried using
> sp and SpatialLinesDataFrame, but overlay does not seem to work with
> SpatialLines(DataFrame) and SpatialPixelsDataFrame:
>
> Error in function (classes, fdef, mtable)  :
>  unable to find an inherited method for function "overlay", for signature
> "SpatialPixelsDataFrame", "SpatialLinesDataFrame"
>
> I also investigated packages raster, trip, and rgeos, without success. Maybe
> the low level functions of rgeos could be used, but it seems a bit out of my
> skills (and time available) at the moment.
>
> Another solution might be to use spgrass6 in conjunction with GRASS, but I'm
> not familiar enough with GRASS to judge if it is a viable alternative...
>
> I'd welcome any hints/thoughts on this question.
> Sincerely,
> Mathieu Basille.
>
>
> --
>
> ~$ whoami
> Mathieu Basille, Post-Doc
>
> ~$ locate
> Laboratoire d'Écologie Comportementale et de Conservation de la Faune
> + Centre d'Étude de la Forêt
> Département de Biologie
> Université Laval, Québec
>
> ~$ info
> http://ase-research.org/basille
>
> ~$ fortune
> ``If you can't win by reason, go for volume.''
> Calvin, by Bill Watterson.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list