[R-sig-Geo] Problem using asc2spixdf in adehabitat package

Ned Horning horning at amnh.org
Thu Dec 3 17:54:11 CET 2009

Hi - I have a script to calculate mahalanobis distance using the 
adehabitat package but I the output image is not the same size as the 
input image and I would like it to be the same. The georeferencing is 
fine so the input and output images line up when displayed in a GIS but 
the image dimensions of the output image are not the same. I use 
"sp_hsm_pard <- asc2spixdf(hsm_pard)" to convert an asc image object to 
a SpatialPixelsDataFrame object. When I type "str(hsm_pard) the result 
is: asc [1:900, 1:1650] but after running asc2spixdf the "sp_hsm_pard" 
object has cells.dim set to 769 1555 and I would expect it to be 900 
1650 since that is the dimension of the asc object.

I expect this is due to NAs in the input image but I haven't been able 
to figure out how create an output image with the same dimensions as the 
input image.

On a related topic, I tried to get information about the asc class using 
getClass("asc") but I get an error that "asc" is not a defined class. Is 
there another way to get information about a class?

Any insight would be appreciated.

All the best,


More information about the R-sig-Geo mailing list