[R-sig-Geo] Problem using mahasuhab

Ned Horning horning at amnh.org
Fri Nov 20 05:22:34 CET 2009


Mathieu,

Thanks for the help - rgdal / spixdf2kasc seems to have done the trick. 
Here is the header from my ascii grid:
--
ncols    900
nrows    1650
xllcorner    0
yllcorner    0
cellsize    1000
NODATA_value    -9999
--

All the best,

Ned

Mathieu Basille wrote:
> 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
>>     
>
>
>



More information about the R-sig-Geo mailing list