Skip to content

raster / polygon overlay

2 messages · laure velez, Roger Bivand

#
Many thanks for the fast replies,



@ Roger : polygons and raster are ok (see attached file).

@  Johannes : I have already try this but the result was not satisfying, using a SpatialPointsDataFrame do not solve the problem as the points are not  inside the polygon (see attached file).

I guess the problem arises because of the raster resolution that is to large ....

Any suggestion would be appreciated,

Please find attached a plot showing the raster (image), the polygon and the centroid of the raster cells : 

image(grid, axes=TRUE)
plot(pol, add=TRUE)
points(coordinates(grid))

Regards,

Laure.
 		 	   		  
_________________________________________________________________
[[elided Hotmail spam]]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20100105/2a958e2d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ex.jpg
Type: image/jpeg
Size: 20164 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20100105/2a958e2d/attachment.jpg>
#
On Tue, 5 Jan 2010, laure velez wrote:

            
Yes, none of the big grid centres falls inside the small polygon. Could I 
suggest that you subset the grid to the area near the polygon (try it out 
by hand, plotting until you have say 16 grid cells)? Then resample using 
spsample with type="regular" to generate say 1600 new points, using 
overlay on the input polygon and on the coercion of the small grid to work 
out which sample points fall into which big grid cell and into the input 
polygon. If you need more precision, increase the number of points per big 
cell from 100.

Roger