[R-sig-Geo] [Moved from R-help] Re: [R] confine a dataframe with a polygon

Roger Bivand Roger.Bivand at nhh.no
Thu Apr 5 13:53:26 CEST 2007


On Wed, 4 Apr 2007, temiz wrote:

> Roger Bivand wrote:
> > On Tue, 3 Apr 2007, temiz wrote:
> >
> >   
> >> hello
> >>
> >> how can I confine a dataframe with a known polygon that is part of whole 
> >> data ?
> >>     
> >
> > Could I suggest following up this question on the R-sig-geo list? It is 
> > not clear what you want to do - are the rows in the data frame points 
> > which may lie inside or outside a polygon? If so, the overlay() methods in 
> > the sp package may be suitable.
> >
> >   
> >> regards
> >>
> >>
> >>     
> >
> >   
> thank you for your reply
> 
> I have not been aware of  that list (R-sig-geo list)
> My data is elevation point data in a text file.
> I want to create DEMs with different interpolation
> methods for comparision.
> Actually I created DEM in GRASS using spline tension.
> Then I want to create DEM in R with different techniques to compare.
> But my data seems so huge for GSTAT-kriging and FIELDS-krig.
> So I decided to select smaller interpolation area within whole data.
> 
> How can I define a subregion in which I do interpolation ?

In R-GRASS, use system("g.region ...") to set the subregion before 
readRAST6().

For interpolation, you have two data sets, the point data for which you 
know z, and the newdata points, often a raster, to which you want to 
interpolate. I guess that you want to define the prediction model based on 
all the data, then predict for tiles of newdata locations for export with 
writeRAST6(). They can be put together in GRASS with system("r.patch 
..."), or a more detailed process taking care of possible overlaps.

> 
> I found locator and chull function that may serve this.
> 
> I will regard your recommendations.
> 
> PS : Thinking facing a memory problem, I refrained from GRASS-R interface.
> 

Use system("g.region ...") to choose a small enough region.

If your observed data are also large volume (a big DEM, for example), you 
will need to be careful how you do things, possibly either using the GDAL 
GRASS plugin and rgdal, or r.out.gdal for say geotiff, and then subset the 
amount of data read in in readGDAL. Users report success with very large 
data sets and rgdal, you just need to do things in sensible subsets.

> 
> 
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list