相关疑难解决方法(0)

通过R中的sf将经度和纬度的序列转换为多边形

我有五个经度和纬度形成这样的形状.

df <- c(order=1:5,
        lon=c(119.4,119.4,119.4,119.5,119.5), 
        lat=c(-5.192,-5.192,-5.187,-5.187,-5.191))
Run Code Online (Sandbox Code Playgroud)

如何使用sf像这样的包轻松地将它们转换为sf多边形数据框?

## Simple feature collection with 1 feature and 0 fields
## geometry type:  POLYGON
## dimension:      XY
## bbox:           xmin: 119.4 ymin: -5.192 xmax: 119.5 ymax: -5.187
## epsg (SRID):    4326
## proj4string:    +proj=longlat +datum=WGS84 +no_defs
## geometry
## 1 POLYGON ((119.4 ...
Run Code Online (Sandbox Code Playgroud)

r r-sf

7
推荐指数
2
解决办法
2601
查看次数

标签 统计

r ×1

r-sf ×1