[R] intersect filled.contour and polygon

Roger Bivand Roger.Bivand at nhh.no
Tue May 1 13:39:37 CEST 2007

On Mon, 30 Apr 2007, Pedro Mardones wrote:

> Dear R users;
> Is there any way to intersect a filled contour image and a polygon? My
> problem is that I want to create a kriging map and the boundaries of
> my map are given by the coordinates of the polygon.
> So far I can superompose the polygon in the filled.contour image but I
> don't know how to get rid of the contour image outside of the polygon
> boundaries.

Two possibilities seem to be present: define your polygon as a hole inside 
the bounding box of the image, with a link between the polygon and the 
bounding box, and fill it; or, perhaps better, only make kriging 
predictions for the polygon. Since you haven't given a code example, it 
isn't obvious how you are making the kriging predictions, but the choice 
of the newdata locations ought to decide - and they do not need to be a 
full grid, or even a regular grid at all.

If you need to follow this up, please consider using the R-sig-geo list.

> Any hint will be appreciated
> PM
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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-help mailing list