【发布时间】:2023-04-03 16:06:01
【问题描述】:
我刚刚开始使用 R-ArcGIS bridge 包arcgisbinding,当我尝试将要素类数据与dplyr 包连接时遇到了问题。这是一个示例,我试图将两个 shapefile 中的臭氧柱放入一个数据框中,然后作为 shapefile 导出回来。
library(dplyr)
library(arcgisbinding)
arc.check_product()
fc <- arc.open(system.file("extdata", "ca_ozone_pts.shp",
package="arcgisbinding"))
d <- arc.select(fc, fields=c('FID', 'ozone'))
p<-arc.select(fc,fields=c('FID', 'ozone'))
p$ozone<-p$ozone*2
p<-left_join(p,d,by="FID")
arc.write(tempfile("ca_new", fileext=".shp"), p)
# original dataframe has shape attributes
str(d)
# new dataframe does not
str(p)
来自arcgisbinding 包,上面的p 和d 是具有形状属性的数据框对象。问题是一旦我使用left_join,我就会丢失连接数据框中的空间属性数据。有没有办法解决这个问题?
【问题讨论】: