在 R 中组合点 shapefile 和道路 shapefile
Combine a point shapefile and a road shapefile in R
我想知道如何在 R 软件中合并两个 shapefile 文件,一个是 Points shapefile,另一个是 roads shapefile。在附件中我留下了我在 Arcgis 软件中结合两个 shapefile 制作的图像。
为了测试,可以从以下网站下载两个 shapefile:https://github.com/JovaniSouza/JovaniSouza5/blob/master/Example.zip
非常感谢!!
如果您只想将数据可视化,那么您可以这样做。请注意,您的道路和点 shapefile 似乎没有相同的投影。 Shapefile 只能包含一种形状类型(线、点、多边形等),因此您无法真正组合它们。
library(sf)
roads <- st_read('Roads/Roads.shp')
pts <- st_read('Points/Points.shp') %>%
st_transform(crs=st_crs(roads))
plot(st_geometry(roads))
plot(st_geometry(pts), add = T, col = 'red', pch = 20)
我想知道如何在 R 软件中合并两个 shapefile 文件,一个是 Points shapefile,另一个是 roads shapefile。在附件中我留下了我在 Arcgis 软件中结合两个 shapefile 制作的图像。
为了测试,可以从以下网站下载两个 shapefile:https://github.com/JovaniSouza/JovaniSouza5/blob/master/Example.zip
非常感谢!!
如果您只想将数据可视化,那么您可以这样做。请注意,您的道路和点 shapefile 似乎没有相同的投影。 Shapefile 只能包含一种形状类型(线、点、多边形等),因此您无法真正组合它们。
library(sf)
roads <- st_read('Roads/Roads.shp')
pts <- st_read('Points/Points.shp') %>%
st_transform(crs=st_crs(roads))
plot(st_geometry(roads))
plot(st_geometry(pts), add = T, col = 'red', pch = 20)