【问题标题】:How to get central points for polygons, necessarily in these polygons (R,sp)如何获得多边形的中心点,必须在这些多边形中(R,sp)
【发布时间】:2017-06-01 16:52:43
【问题描述】:

如何获得必然落在这些多边形中的多边形的中心点?对于许多非凸多边形,仅获得质心就会落在多边形之外。

理想情况下,多边形将是 R 中的 SpatialPolygons,并且中心点也将作为 sp 对象返回。

【问题讨论】:

  • 如果质心不是您想要的,您对“中心点”的标准是什么?不难,但根据定义,质心就是中心

标签: r gis sp


【解决方案1】:

您可以使用spatDataManagement package 中的GetCentralPoints。 这源自网络上其他地方的this answer

执行该示例将返回:

plot(woods[1:5,])
# the centroids
plot(GetCentroids(woods[1:5,]),add=T)
# the central points guaranteed to be in the polygons
plot(GetCentralPoints(woods[1:5,]),add=T,col="blue")
legend("bottomright",legend=c("Centroids","Central points"),col=c("black","blue"),pch="+")

你得到(注意底部的多边形)

【讨论】:

    猜你喜欢
    • 2017-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-05
    • 2017-11-02
    • 1970-01-01
    相关资源
    最近更新 更多