[R-sig-Geo] Step characteristics on raster maps
basille at ase-research.org
Fri Dec 10 20:57:06 CET 2010
Dear list members,
Sorry if I didn't replied earlier, but here is the solution I finally
used. Thanks to Pierre Racine who helped us, I installed a PostgreSQL
data base, with PostGIS and WKTRaster . WKTRaster allows to handle
raster maps in addition to all vector classes already supported by PostGIS.
In the end, after the import of trajectories within the db (via ltraj >
SpatialLinesDataFrame > Shapefile > DB, but there might be easier
solutions), it is relatively easy to get the overlay of the trajectory
with raster maps, after some SQL learning. With this approach, it is
actually possible to split each segment into smaller segments according
to the underneath pixels. In the end, it is thus possible to get the
exact proportion of each segment regarding the underlying map. And the
process is incredibly fast (compared to pure R code or ArcGIS).
The only current drawback is that WKTRaster can handle only integer
maps. The workaround for continuous maps is to scale it, e.g., between 0
and 100 to get enough information with the integer part of it. WKTRaster
is still under heavy development, and this should be fixed in the future.
Hope this helps other people interested!
Le 30/09/2010 08:46, Mathieu Basille a écrit :
> 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
> I'd welcome any hints/thoughts on this question.
> Mathieu Basille.
Mathieu Basille, Post-Doc
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
``If you can't win by reason, go for volume.''
Calvin, by Bill Watterson.
More information about the R-sig-Geo