On Tue, 5 Jan 2010, laure velez wrote:



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))


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


Regards,

Laure.

_________________________________________________________________
[[elided Hotmail spam]]



--
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.biv...@nhh.no

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to