获取数据框列中坐标的边界框
我有一个包含两列数字类型的数据框。
foo <- data.frame(replicate(2,sample(10.1:15.2,100,rep=TRUE)))
X1 X2
1 13.1 15.1
2 13.1 11.1
3 13.1 15.1
4 10.1 13.1
5 15.1 11.1
6 13.1 11.1
...
这些数字代表 4326
中的坐标。 X1
是纬度,X2
是经度。我如何获得所有这些坐标的边界框?
I have a dataframe with two columns of type numeric
.
foo <- data.frame(replicate(2,sample(10.1:15.2,100,rep=TRUE)))
X1 X2
1 13.1 15.1
2 13.1 11.1
3 13.1 15.1
4 10.1 13.1
5 15.1 11.1
6 13.1 11.1
...
These numbers represent coordinates in 4326
. X1
is latitude, X2
is longitude. How would I get the bounding box for all these coordinates?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
sfheaders
稍微Suxpint略微固定,如果您需要在软件包中使用的轻重量选项。但是,如果您在工作流程中使用
sf
,则纯sf
方法很好。Slightly more succint using
sfheaders
if you want a light-weight option for using in a package.But if you're using
sf
in your workflow anyway, then the puresf
approach is fine.转换为
sf
并使用st_bbox
:Convert to
sf
and usest_bbox
: