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

问题描述 投票:5回答:1

如何使用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个回答
0
投票
您有两种选择。您可以使用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)

可以在arcgisbinding中找到R-ArcGIS Bridge(和here程序包的详细信息。

© www.soinside.com 2019 - 2024. All rights reserved.