【问题标题】:How to write sf object as shapefile to ESRI file geodatabase with st_write?如何使用 st_write 将 sf 对象作为 shapefile 写入 ESRI 文件地理数据库?
【发布时间】:2019-01-08 08:53:48
【问题描述】:

如何使用 st_write 将 sf 对象作为 shapefile 写入文件地理数据库?

我不太了解与文件地理数据库相关的 st_write 的“dsn”、“layer”和“driver”参数。

例如,我已经尝试了这两种方法,但都没有运气

st_write(sf.object, dsn = "filepath/FileGeoDatabase.gbd",layer="name of output layer", driver="OpenFileGDB")

st_write(sf.object, dsn = "filepath/FileGeoDatabase.gbd",layer="name of output layer", driver="ESRI Shapefile")

【问题讨论】:

    标签: r esri sf


    【解决方案1】:

    这里有几件事:首先,您不能将 shapefile 写入 ESRI 地理数据库,因为其中只能存储要素类和要素数据集。其次,您不能通过sf 写入地理数据库;你只能阅读它们。

    您有几个选择。您可以使用 sf 将数据保存为地理数据库之外的 shapefile(或任何其他空间数据格式):

    library(sf)
    
    ## it will guess the driver automatically based on the .shp extension
    st_write(sf.object, "data/my_shapefile.shp")
    

    或者,如果您绝对需要在地理数据库中写入,您可以使用arcgisbinding 库,但请注意您需要使用具有有效 ArcGIS 许可的计算机。因此,这在 GNU/Linux 和 Mac 上是不行的。

    由于我在 GNU/Linux 上,我无法验证这是否有效,但它应该是这样的:

    library(arcgisbinding)
    
    arc.write("data.gdb/fc", sf.object)
    

    有关 R-ArcGIS Bridge(和 arcgisbinding 包)的详细信息,请访问 here

    【讨论】:

      猜你喜欢
      • 2021-02-27
      • 2021-12-09
      • 2014-02-25
      • 2022-08-05
      • 1970-01-01
      • 2016-10-08
      • 2017-03-03
      • 2022-11-19
      • 2017-03-13
      相关资源
      最近更新 更多