分别按照要素类、表格、要素数据集、栅格数据集分别将数据存储到新的数据库
import arcpy
from arcpy import env
import os
# Allow for the overwriting of file geodatabases, if they already exist #
env.overwriteOutput = True
# Set workspace to folder containing personal geodatabases #
env.workspace = arcpy.GetParameterAsText(0)
# Identify personal geodatabases #
for pgdb in arcpy.ListWorkspaces("*", "FileGDB"):
# Set workspace to current personal geodatabase#
print pgdb
env.workspace = pgdb
# Create file geodatabase based on personal geodatabase#
fgdb = pgdb[:-4] + "2.gdb"
arcpy.CreateFileGDB_management(os.path.dirname(fgdb), os.path.basename(fgdb))
# Identify feature classes and copy to file gdb #
for fc in arcpy.ListFeatureClasses():
print "Copying feature class " + fc + " to " + fgdb
arcpy.Copy_management(fc, fgdb + os.sep + fc)
# Identify tables and copy to file gdb #
for table in arcpy.ListTables():
print

该博客详细介绍了如何利用Arcpy模块,针对要素类、表格、要素数据集和栅格数据集,逐个进行复制操作,实现数据库从源位置到目标位置的完整迁移。
最低0.47元/天 解锁文章
1213

被折叠的 条评论
为什么被折叠?



