Posible duplicado:
¿Cómo mover SHP a gdb con la licencia de ArcView?
Dejémoslo corto, tengo numerosos mxd con capa proveniente de .SHP y varios servidores WMS que necesito pasar a un gdb. Lo que quiero es abrir el mxd y ejecutar un script que seleccione todas las capas .SHP en la TOC, cree un gdb, exporte el .SHP y cree un nuevo MXD con la nueva ruta apuntando a gdb.
El siguiente es el código que escribí, pero no puedo tenerlo para seleccionar sólo el .SHP, lo intenté con dataType pero todos salen como "FeatureLayer"... ¡necesito ayuda!
# Import system modules
import arcpy, datetime, os, traceback
from arcpy import env
# Load required toolboxes...
arcpy.AddToolbox("C:\\Program Files (x86)\\ArcGIS\\Desktop10.0\\ArcToolbox\\Toolboxes\\Data Management Tools.tbx")
# Get the active map document
import arcpy.mapping
mxd = arcpy.mapping.MapDocument ("CURRENT")
# List broken links
# arcpy.mapping.ListBrokenDataSources(mxd)
# Set environment settings
ws = "C:\\PARK"
arcpy.env.workspace = ws
print("env.workspace completed successfully")
installdir = arcpy.GetInstallInfo("desktop")
#check GDB exist
gdb_nam = "test.gdb"
gdb_full_path = os.path.join(ws,gdb_nam)
if os.path.exists(gdb_full_path):
arcpy.Delete_management(gdb_full_path)
print("GDB checked")
# Execute CreateFileGDB
arcpy.CreateFileGDB_management(ws, gdb_nam)
print("CreateFileGDB completed successfully")
outWorkspace = gdb_full_path
# Iterate
list = []
for df in arcpy.mapping.ListDataFrames (mxd):
for fc in arcpy.mapping.ListLayers (mxd, "", df):
if (fc.datasetName.endswith(".shp")):
list.append(fc)
for fc in fclist:
arcpy.FeatureClassToGeodatabase_conversion(fc, gdb_full_path)