Andrew Niccolai writes: > I would like to identify every polygon from the first object > [...] that completely or even partially [...] > falls within any given polygon from the second object (crown areas). This can be done in the package 'spatstat'. If your polygons are simply connected (i.e. they do not consist of multiple pieces and do not have any holes) then use the function overlap.xypolygon(A, B) where A and B are two polygons. This function is not documented (sorry about that). Both A and B should be in the format list(x, y) where x and y are numeric vectors containing the x and y coordinates of the vertices of the polygon, traversed in anti-clockwise order, without repeating the first vertex. The value returned by overlap.xypolygon is the area of the overlap (intersection) between the two polygons. The area of a polygon is computed by area.xypolygon(A) where A is again a simply-connected polygon in the same format as above. So for example, you could decide that if overlap.xypolygon(A, B)/area.xypolygon(B) > 0.9 then you'll declare that B is substantially contained in A. (Or whatever threshold you choose). If your polygons are not simply-connected (e.g. they consist of several pieces) you could use the functions overlap.owin(U, V) area.owin(U) where U and V are objects of class "owin" representing spatial regions. See help(owin) for details of the format. Hope that helps Adrian Baddeley
Identifying overlapping polygons
1 message · Adrian Baddeley