[R-sig-Geo] ASCII grid file - extracting data after import with readGDAL()

Michał Kwieciński jamesbond6 at gmail.com
Fri Aug 26 16:45:02 CEST 2011


Learning about existence of "band1" was what I actually needed. Apart
from one bigger spatial econometrics project, I haven't done much work
with R yet, so I still lack some knowledge on basic operations - I
will try to remember about the names() function next time. I thought
the problem would lie somewhere deeper, shame on me.

> I use the raster package for asci files

It looks promising, I'll have a look into it. Thanks for the tip.

Thank you all for prompt replies and help, much appreciated.

Regards,
Michal Kwiecinski

2011/8/26 Matthew Landis <landis at isciences.com>:
> If you want to see more info of the dataset, you can also view it with
>
> str(map at data)
>
> or
> head(map at data)
>
> Matt
>
>
>
> On 8/26/2011 9:57 AM, Forrest Stevens wrote:
>>
>> As you said, readGDAL will give you a SpatialGridDataFrame object, which
>> behaves much like a normal data.framet.  Your best bet is to run it
>> through
>> names to see what data are available to work with:
>>
>> names(map)
>>
>> Like a regular data.frame this will give you the bands or data read in
>> from
>> your ASCII grid, on which you can pull subsets or index like you would a
>> normal vector (e.g. pretend your map object has "band1" as its only data,
>> you can pull a subset of the first 10 grid values like this:
>>
>> map$band1[1:10]
>>
>> I hope that gets you closer to solving the rest of your question,
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~
> Matthew Landis, Ph.D.
> Research Scientist
> ISciences, LLC
> 61 Main St. Suite 200
> Burlington VT 05401
> 802.864.2999
> ~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>



More information about the R-sig-Geo mailing list