[Biomod-commits] Extracting values from a raster

Wilfried Thuiller wilfried.thuiller at ujf-grenoble.fr
Thu Sep 9 13:28:49 CEST 2010


Few tips:

1- Make sure you really load the raster. You might need to put the  
complete path to the raster in the raster call.
for instance, plot the raster.

muestra = raster("cld6190_ann.asc")
plot(muestra)

2- Put your data in the C folder. There are free space in your path  
and I gather spanish signs.
Make sure to put the data at the root with no space in the same and  
without any particular signs.



Le 9 sept. 10 à 13:21, Manuel Spínola a écrit :

> Thank you very much Wilfried,
>
> However,
>
> df = xyValues(muestra, loca)
> Error en .local(.Object, ...) :
>   `C:/Documents and Settings/Manuel/Mis documentos/Manolo/Proyectos  
> en R/Análisis Espacial/cld6190_ann.asc' does not exist in the file  
> system,
> and is not recognised as a supported dataset name.
>
>
> Best,
>
> Manuel
>
>
> On 08/09/2010 10:53 p.m., Wilfried Thuiller wrote:
>>
>> Because you need to use the raster function to load the raster and  
>> not the readAsciiGrid.
>>
>> muestra = raster("cld6190_ann.asc")
>>
>> loc = read.csv(file="bradypus.csv",head=TRUE,sep=",")
>> loca = loc[,2:3]
>>
>> df = xyValues(muestra, loca)
>>
>> The xyValues function works with raster object only
>>
>>
>>
>>
>> Le 9 sept. 2010 à 05:13, Manuel Spínola a écrit :
>>
>>> Dear list members,
>>>
>>> I am trying to use xyValues to extract values from a raster file:
>>>
>>> muestra = readAsciiGrid("cld6190_ann.asc")
>>>
>>> loc = read.csv(file="bradypus.csv",head=TRUE,sep=",")
>>> loca = loc[,2:3]
>>>
>>> df = xyValues(muestra, loca)
>>> Error en function (classes, fdef, mtable)  :
>>>  unable to find an inherited method for function "xyValues", for  
>>> signature "SpatialGridDataFrame", "data.frame"
>>>
>>> Why did I get the error message?
>>>
>>> Best,
>>>
>>> Manuel
>>>
>>> -- 
>>> Manuel Spínola, Ph.D.
>>> Instituto Internacional en Conservación y Manejo de Vida Silvestre
>>> Universidad Nacional
>>> Apartado 1350-3000
>>> Heredia
>>> COSTA RICA
>>> mspinola at una.ac.cr
>>> mspinola10 at gmail.com
>>> Teléfono: (506) 2277-3598
>>> Fax: (506) 2237-7036
>>>
>>> _______________________________________________
>>> Biomod-commits mailing list
>>> Biomod-commits at lists.r-forge.r-project.org
>>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/biomod-commits
>>
>> --------------------------
>> Dr. Wilfried Thuiller
>> Laboratoire d'Ecologie Alpine, UMR CNRS 5553
>> Université Joseph Fourier
>> BP53, 38041 Grenoble cedex 9, France
>> tel: +33 (0)4 76 51 44 97
>> fax: +33 (0)4 76 51 42 79
>>
>> Email: wilfried.thuiller at ujf-grenoble.fr
>> Home page: http://www.will.chez-alice.fr
>> Website: http://www-leca.ujf-grenoble.fr/equipes/tde.htm
>>
>> FP6 European MACIS project: http://www.macis-project.net
>> FP6 European EcoChange project: http://www.ecochange-project.eu
>>
>>
>>
>>
>>
>
>
> -- 
> Manuel Spínola, Ph.D.
> Instituto Internacional en Conservación y Manejo de Vida Silvestre
> Universidad Nacional
> Apartado 1350-3000
> Heredia
> COSTA RICA
> mspinola at una.ac.cr
> mspinola10 at gmail.com
> Teléfono: (506) 2277-3598
> Fax: (506) 2237-7036

-------------------------
Dr. Wilfried Thuiller
Laboratoire d'Ecologie Alpine, UMR CNRS 5553
Université Joseph Fourier
BP53, 38041 Grenoble cedex 9, France
tel: +33 (0)4 76 51 44 97
fax: +33 (0)4 76 51 42 79

Email: wilfried.thuiller at ujf-grenoble.fr
Home page: http://www.will.chez-alice.fr
Website: http://www-leca.ujf-grenoble.fr/equipes/tde.htm

FP6 European MACIS project: http://www.macis-project.net
FP6 European EcoChange project: http://www.ecochange-project.eu






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/biomod-commits/attachments/20100909/7e3a1b3b/attachment.htm>


More information about the Biomod-commits mailing list