码迷,mamicode.com
首页 > 数据库 > 详细

arcgis python 删除一个数据库所有数据

时间:2019-08-15 23:01:08      阅读:257      评论:0      收藏:0      [点我收藏+]

标签:cep   red   def   must   tables   rcp   nbsp   一个   desc   

# -*- coding: cp936 -*-
import xlrd # must init xlrd
import arcpy
import os

def main():
    arcpy.env.workspace =gdbFile
    datasets = arcpy.ListDatasets()
    for dataset in datasets:
        arcpy.AddMessage(u"gisoracle删除数据集"+dataset)
        arcpy.Delete_management(dataset,"FeatureDataset")

    featureclasses = arcpy.ListFeatureClasses()
    for fc in featureclasses:
        arcpy.AddMessage(u"gisoracle删除要素类"+fc)
        arcpy.Delete_management(fc)

    tables = arcpy.ListTables()
    for table in tables:
        arcpy.AddMessage(u"gisoracle删除表格"+table)
        arcpy.Delete_management(table)

    rasters = arcpy.ListRasters()
    for raster in rasters:
        arcpy.AddMessage(u"gisoracle删除栅格"+raster)
        arcpy.Delete_management(raster)

gdbFile = arcpy.GetParameterAsText(0) #gdb


try:
    main()
    #arcpy.SetParameterAsText(3, inFeature)  # Is polygon
except Exception, ErrorDesc:
    arcpy.AddError(u"错误:"+str(ErrorDesc))

 

arcgis python 删除一个数据库所有数据

标签:cep   red   def   must   tables   rcp   nbsp   一个   desc   

原文地址:https://www.cnblogs.com/gisoracle/p/11361010.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!