r - R中经纬度点簇的多边形
问题描述
我正在尝试从将接触所有外部点的点边界簇创建多边形。任何有助于改进我的代码的帮助将不胜感激。
library(dplyr)
library(sf)
df<- read.table(text ="lon lat
74.03687 30.17482
74.23605 30.23773
74.24127 29.95988
74.29211 30.07575
74.25612 30.17687
74.15972 30.06242
74.06484 30.11025
74.36046 30.02749
74.08133 30.01889
74.26168 30.16881
73.91083 30.01378
74.00881 30.07585
74.40638 29.97712
74.34974 30.22231
74.20501 30.11133
74.18108 30.01113
74.00717 30.11362
73.94891 30.03807
74.18977 30.14367
74.18857 30.13621
74.19862 30.15222
74.19376 30.13425",header= T)
polygon <- df %>%
st_as_sf(coords = c("lon", "lat"), crs = 4326) %>%
summarise(geometry = st_combine(geometry)) %>%
st_cast("POLYGON")
plot(polygon)
解决方案
推荐阅读
- c++ - C++ 池分配器程序仅在控制台关闭时崩溃
- javascript - Angular http 模块 - 发布标题
- java - scala类成员导致错误“类'类'必须声明为抽象或实现成员'成员'”
- dialogflow-es - 在 Actions on Google 中使用单个话语调用多个意图
- regex - 在引号中动态包装子字符串
- c# - LINQ XML C# 删除循环中的 where 条件
- c++ - 实现递归函数,避免在c ++中由循环调用include(没有#pragma once)引起的无限循环输入
- swift - 如何在 Swift Playground 中调用 UIBezier 大纲?
- node.js - 如何在 Nodejs 和 Express 中重用 Db 连接
- c# - Unity 有效地在列表中查找 A 和 B 之间的差异