python 将MXD中的所有要素类添加到地理数据库

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 将MXD中的所有要素类添加到地理数据库相关的知识,希望对你有一定的参考价值。

'''
A Python script to take the feature classes in an MXD file and add them to a geodatabase
'''
import arcpy

# Specify MXD with data to send to GDB
# TODO Make this so you don't have to have ArcGIS open. User should be able to take a user input and export to GDB of choice
mxd = arcpy.mapping.MapDocument('CURRENT')

# Specify the data frame where your features are
# Allow users to input their own data frame name
df = arcpy.mapping.ListdataFrames(mxd, 'Layers')[0]
# Make list of data in data frame
df_list = list(df)
df_layer_list = []
d = 0
while d < len(df_list):
  df_item = arcpy.mapping.ListLayers(mxd, '', df)[d].name
  df_layer_list.append(df_item)
  d+=1

arcpy.FeatureClassToGeodatabase_conversion(df_layer_list, '<path to output GDB>')

以上是关于python 将MXD中的所有要素类添加到地理数据库的主要内容,如果未能解决你的问题,请参考以下文章

cad如何导入arcgis,详细步骤

如何把ARCGIS图转成CAD图

怎样创建arcgis的数据库'

arcgis python 使用光标和内存中的要素类将数据加载到要素集

arcengine featureclass里怎么添加feature

gis个人数据库要素类可以变为要素类吗