Arcpy 批量转化工具

1 mdb导出为shp文件

import arcpy

arcpy.env.workspace = r"D:\07\07.mdb"

outLocation = r"D:\07"
# Use Python's built-in function len to reveal the number of feature classes
#   in the workspace
fcs = arcpy.ListFeatureClasses()
for fc in fcs: 
    # Copy the features from the workspace to a folder
    arcpy.FeatureClassToShapefile_conversion(fc, outLocation)

    print fc

print fcCount

2 mxd文档导出为图片

import arcpy, os, time
path = r'D:\可达性分析'
res = 100

print '程序开始:' + str(time.ctime())
for afile in os.listdir(path):
  if afile[-3:].lower() == 'mxd':
    mxd = arcpy.mapping.MapDocument(os.path.join(path,afile))
    arcpy.mapping.ExportToJPEG(mxd, os.path.join(path,afile[:-3] + 'jpg'), resolution = res)
    del mxd
print '程序结束:' + str(time.ctime())


转载自:https://blog.csdn.net/sprintwater/article/details/30057135

You may also like...