rinterpolationpolygonspatial-interpolation

Polygon boundary interpolation in R


I have a polygon dataframe: enter image description here

With vertice coordinates:

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

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


Solution

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