Jeffrey,

Just look at:

library(maptools)
?readAsciiGrid

library(rgdal)
?readGDAL

and try the examples. They read grid files direct and in both cases the 
output is an object of class "SpatialGridDataFrame". This class is 
easily handled then with spsample() or overlay().

I have transformed "SpatialPolygonDataFrame" into "SpatialGridDataFrame" 
some months ago. If I remember right I managed clipping a SpatialGrid 
(at te resolution you want) onto a "SpatialPolygonDataFrame" with the 
fonction overlay(). Each pixel of the grid can be then linked to the 
attributes of the polygon it belongs to. Maybe Roger Bivand or Edzer 
Pemesba can comment on that... it may be some other more straight way to 
do it...

Hope this can help,

Patrick


Jeffrey Stratford a écrit :
> Patrick,
>
> Thanks very much for the reply.  I went through the maptools pdf and I
> did not find where one can alter readShapePoly for a raster/grid file. 
> Do you have an example of importing an ESRI grid file(s).
>
> In ArcCatalog (using WindowsXP) the file is
> C:\Georgia\GIS\landcov_2\landcov_2 (no extensions) and using explorer
> there are seven .adf files and a xml file in the landcov_2 folder.  
>
> Thanks for your patience,
>
> Jeff
>
>   
>>>> Patrick Giraudoux <patrick.giraudoux@univ-fcomte.fr> 01/05/07 6:01
>>>>         
> AM >>>
> Jeffrey,
>
> You may want to have a look at the maptools and sp packages. maptools
> has a readShapePoly() function which straightforward read polygon
> shapefiles (equivalent exist for "points" , "lines", "grid", etc.), and
> then you can use spsample() from the package sp.
>
> sp and maptools combined provide extremely powerful tools for reading,
> handling (see eg the function overlay()) and writing shapefiles. The
> package rgdal even permit (among many other things) conversion between
> projections!!!
>
> To be somehow used to S4 objects may be an advantage since each object
> once in R has a fixed structure organised with the concept of "slots"
> whose avantage is to be completely transparent and whose drawback is a
> relative level of complexity at first sight (but don't stay on this
> impression: one can go through quite easy).
>
> Patrick
>
>
>
>   
>> Date: Thu, 04 Jan 2007 20:49:06 -0600
>> From: "Jeffrey Stratford" <stratja@auburn.edu>
>> Subject: [R-sig-Geo] random samples of a grid
>> To: <r-sig-geo@stat.math.ethz.ch>
>> Message-ID: <459D6842020000F20001D91A@TMIA1.AUBURN.EDU>
>> Content-Type: text/plain; charset=US-ASCII
>>
>> Hi,  is there a way to sample an ESRI grid using random sample points?
>>     
>
>   
>> In the past I used ESRI's spatial analyst but I would like to switch
>>     
> all
>   
>> my analyses to R if possible.  The grid is from the National Land
>>     
> Cover
>   
>> Dataset  (30m res, 7 landcover classes).  I had roadside points from
>> which I extracted data such as % grassland, % pine, etc in buffers of
>> 90, 210, and 990 m radii.  I would like to generate 200 random samples
>> from the same map to compare the roadside points to random samples
>>     
> (and,
>   
>> hopefully, there are no differences).   Make sense?  Hope so. 
>>
>> Thanks,
>>
>> Jeff
>>
>> ****************************************
>> Jeffrey A. Stratford, Ph.D.
>> Postdoctoral Associate
>> 331 Funchess Hall
>> Department of Biological Sciences
>> Auburn University
>> Auburn, AL 36849
>> 334-329-9198
>> FAX 334-844-9234
>> http://www.auburn.edu/~stratja
>>
>>
>>
>> ------------------------------
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo@stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>>
>> End of R-sig-Geo Digest, Vol 41, Issue 2
>> ****************************************
>>
>>
>>
>>   
>>     
>
>
>
>
>
>
>
>   


	[[alternative HTML version deleted]]


