如何在R中的sf包中查找区域级几何图形
我想使用 sf
和 plotly
包绘制地理空间地图。但是,我没有国家级数据,只有地区级数据(亚洲、欧洲、拉丁美洲等)。这是我将要处理的数据集的模型,我正在寻找一种查找经度、纬度和几何形状的方法。我打算先收集Excel中的所有数据,然后将它们移动到R
中进行分析
我查找了多个包/数据集,例如 rnaturalearth< /代码>,
maps::map
等,但我找不到正确的纬度/经度/坐标或区域的几何形状。我在哪里可以找到它们?提前致谢
I want to plot a geospatial map using sf
and plotly
package. However, I don't have country-level data, only region-level data (Asia, Europe, Latin America, etc.). This is the mock-up of the dataset I will be working on, I'm looking for a way to lookup the longitude, latitude, and geometry. I plan to collect all the data in Excel first, and later move them to R
for analysis
I've looked for several packages/datasets e.g., rnaturalearth
, maps::map
, etc, but I couldn't find the correct latitude/longitude/coordinates or the geometry of the regions. Where can I find them? Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这里,您对您的问题有一些想法:
.gpkg
格式。请在此处找到如何生成您提到的数据集。
我将在这里使用联合国地理区域分类。这在
countrycode
包中可用,因此基本上我将每个 ISO-3 国家/地区代码映射到相应的区域。之后,我按地区对国家进行分组,这样我就可以按地区获得单一的几何图形。最后,我提取边界框并将它们附加到数据集:Created on 2022-03-23 by reprex 包 (v2.0.1)
here you have some thoughs about your question:
.gpkg
format.Please find here how to produce a dataset as the one you mention.
I would use here the geographic regions classification of the UN. This is available on the
countrycode
package so basically I map each ISO-3 country code to the corresponding region. After, I group the countries by region so I can have a single geometry by region. By last, I extract the bounding boxes and append them to the dataset:Created on 2022-03-23 by the reprex package (v2.0.1)