【发布时间】:2021-07-05 15:22:28
【问题描述】:
我正在开展一个涉及离岸位置 GPS 坐标的项目。我正在寻找测量每个点与海岸的距离。我已经在 QGIS 中创建了相关海岸线的 shapefile,并且我已经使用 st_read() 函数(在本例中名为“biminishore”)成功地将其导入到 R 中。
使用以下代码,我可以在 ggplot2 中绘制我的 shapefile:
bplot = ggplot() +
geom_sf(data = biminishore, size = 0.1, color = "black", fill = "green1") +
ggtitle("Bimini, The Bahamas") +
coord_sf() +
theme_classic()
plot(bplot)
现在,我想在导入的 shapefile 上添加位置坐标(以 .csv 格式导入到 R 中,Lat 和 Lon 具有单独的列)作为图层。谁能建议如何以一种允许我计算每个点与最近海岸线点之间的距离的方式进行此操作?
我目前的尝试给出了错误:Error in st_transform.sfc(st_geometry(x), crs, ...) : cannot transform sfc object with missing crs
我认为这意味着我的坐标系不兼容,但尚未找到解决方法。到目前为止,我已经尝试使用SpatialPoints() 组合我的点列。我也尝试过使用多种形式的st_set_crs() 和st_transform(),但我还没有运气。任何帮助是极大的赞赏!谢谢!
【问题讨论】: