[R-sig-eco] from estUD to SpatialGridDataFrame in adehabitatMA

Clement Calenge clement.calenge at oncfs.gouv.fr
Fri Mar 23 17:33:46 CET 2012


> Ultimately, I need to export the objects to Arc/Info ASCII Grid format,
> which can be achieved by using the Gdal AAIGrid driver, via the rgdal
> package.  This fails in my system (using your ud object above):
>
> ---<--------------------cut here---------------start------------------->---
> library(rgdal)
> locs.gtiff<- create2GDAL(ud[[1]],
>                            drivername="GTiff")
> locs.aaigrid<- copyDataset(locs.gtiff,
>                              driver="AAIGrid")
> saveDataset(locs.aaigrid, "~/tmp/test.asc")
> ---<--------------------cut here---------------end--------------------->---
>
> Returns this:
>
> Error in .local(.Object, ...) : Dataset copy failed
>
> ---<--------------------cut here---------------start------------------->---

I have the same problem. But I am not sure that the class estUD is the 
cause here. Indeed, transforming the object to the class 
SpatialPixelsDataFrame does not change the problem:

 > locs.gtiff <- create2GDAL(as(ud[[1]], "SpatialPixelsDataFrame"),
+                           drivername="GTiff")
 > locs.gtiff <- create2GDAL(ud[[1]],
+                           drivername="GTiff")
 > locs.aaigrid <- copyDataset(locs.gtiff,
+                             driver="AAIGrid")
 > saveDataset(locs.aaigrid, "~/tmp/test.asc")
Error in .local(.Object, ...) : Dataset copy failed

I am not familiar with these functions so I will be of little help here.
However, you may still use the function "write.asciigrid" from sp.
Best,

Clément Calenge.


> R>  sessionInfo()
> R version 2.15.0 beta (2012-03-16 r58769)
> Platform: x86_64-pc-linux-gnu (64-bit)
>
> locale:
>   [1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C               LC_TIME=en_CA.UTF-8
>   [4] LC_COLLATE=en_CA.UTF-8     LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_CA.UTF-8
>   [7] LC_PAPER=C                 LC_NAME=C                  LC_ADDRESS=C
> [10] LC_TELEPHONE=C             LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
>   [1] rgdal_0.7-8         adehabitatHR_0.3.4  adehabitatLT_0.3.4  CircStats_0.2-4
>   [5] boot_1.3-4          MASS_7.3-17         adehabitatMA_0.3.3  ade4_1.4-17
>   [9] rgeos_0.2-5         stringr_0.6         deldir_0.0-16       sp_0.9-97
> [13] latticeExtra_0.6-19 RColorBrewer_1.0-5  lattice_0.20-6
>
> loaded via a namespace (and not attached):
> [1] grid_2.15.0  plyr_1.7.1   tools_2.15.0
> ---<--------------------cut here---------------end--------------------->---
>
>


-- 
Clément CALENGE
Cellule d'appui à l'analyse de données
Direction des Etudes et de la Recherche
Office national de la chasse et de la faune sauvage
Saint Benoist - 78610 Auffargis
tel. (33) 01.30.46.54.14



More information about the R-sig-ecology mailing list