如何计算R中多边形重叠的面积? [英] How to calculate the area of polygon overlap in R?
问题描述
有人知道如何计算R中2个或更多多边形之间的公共面积吗?我希望这种计算的输出是该重叠区域的新多边形的坐标. 干杯
Does anyone know how to calculate the area in common between 2 or more polygons in R? I would like to have the output of such a calculation be the coordinates of a new polygon for that area of overlap. Cheers
推荐答案
这些天来,我将使用'raster'包中的'intersect','cover','erase','union'和相关函数.他们为保留顶级对象和属性付出了艰苦的努力.
these days I would use the 'intersect', 'cover', 'erase', 'union' and related functions in the 'raster' package. They do the hard work to keep the top-level object and attributes.
原点:
您可以将rgeos
软件包及其gIntersection
函数一起使用.线对之间的相继呼叫以及由此产生的交叉路口将带您到达那里.参见
ORIG:
You could use the rgeos
package with its gIntersection
function. Successive calls between pairs and resulting intersections will get you there. See
library(rgeos)
?gIntersection
您将需要进入sp
包中的"SpatialPolygons"结构,以获取最终坐标.参见小插图("sp").
You will need to get into the structure of "SpatialPolygons" in the sp
package to get the final coordinates. See the vignette("sp").
这篇关于如何计算R中多边形重叠的面积?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!