[R-sig-Geo] Problem using mahasuhab

Mathieu Basille basille at biomserv.univ-lyon1.fr
Fri Nov 20 05:11:48 CET 2009


Hi Ned,

Adehabitat was not meant to import all kind of raster maps. It might be
that your file is not in the right format. Are your file with such a header:

ncols 308
nrows 435
xllcorner 400000
yllcorner 6515000
cellsize 1000
NODATA_value -9999

(whatever the values are)

If yes, then it might be another deeper problem... Can you read it
through rgdal? If yes, you can use it and then convert it to a kasc
class, following this example:

bla <- readGDAL("your_map.asc")
blaK <- spixdf2kasc(bla)

Hope this helps,
Mathieu.


Ned Horning a écrit :
> Hi - I was wondering if anyone out there can help with my effort to
> create habitat suitability maps using mahasuhab from the adehabitat
> package or another package if there is a better option. I would like to
> compare the resulting maps with some software a colleague is working on.
> 
> When I try to import an ascii grid using the import.asc method I get the
> following error:
> -- 
> Error in if ((yll[[1]][1] == "yllcenter") | (xll[[1]][1] ==
> "YLLCENTER")) corny <- FALSE :
>  missing value where TRUE/FALSE needed
> In addition: Warning messages:
> 1: In import.asc(filename, type = "numeric") : NAs introduced by coercion
> 2: In import.asc(filename, type = "numeric") : NAs introduced by coercion
> -- 
> 
> I am able to read the test ascii grid file that comes with the package
> just fine. I can also read my file using stack() from the raster package
> but I don't know how to convert that RasterStack to an asc or kasc
> object which seems to be necessary to run mahasuhab.
> 
> Any pointers?
> 
> Ned


-- 

~$ 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.



More information about the R-sig-Geo mailing list