R中的多边形边界插值 [英] Polygon boundary interpolation in R

查看:136
本文介绍了R中的多边形边界插值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个多边形数据框:

I have a polygon dataframe:

具有顶点坐标:

43740.95    40726.46
43741.36    40720.19
43742.67    40729.28
43743.99    40716.16
43745.52    40730.97
43748.72    40714.19
43748.72    40731.14
43748.72    40714.19
43752.23    40714.76
43752.86    40729.43
43755.27    40716.68
43756.77    40723.24
43757.19    40719.73

R中是否有任何方法可以对空间对象进行插值,以使边界更平滑?

Is there any way in R to interpolate spatial objects such that the boundary could be more smooth?

推荐答案

您可以使用

You can use the smoothr package for smoothing an sf object. I created an example based on your data where data is your sample that you provided. Because your polygon is an irregular shape, the smoothing is going to also look irregular. You can adjust the smoothing as need be or change the smoothing algorithm. However, a spline will probably work in your case.

library(sf)
library(smoothr)

smooth_poly <- data %>% 
  st_as_sf(coords=c("x", "y")) %>% 
  st_union() %>% 
  st_convex_hull() %>% 
  smooth(method='spline', n=1000)

这篇关于R中的多边形边界插值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆