ARCGIS自动批量导出图片(JPG、BMP、PNG)

ARCGIS自动批量输出图片(JPG、BMP、PNG)

批量输出图片工具:

免费下载链接: https://pan.baidu.com/s/1gVfTLTxQCQ6uiz1mmtNsNA?pwd=8j5n 提取码: 8j5n

ARCGIS自动批量导出图片(JPG、BMP、PNG)_第1张图片
ARCGIS自动批量导出图片(JPG、BMP、PNG)_第2张图片

批量快速导出图片(JPG、BMP、PNG,每张图都会独立显示本图斑的范围线,不会附带其他图斑范围线哦,整洁美观!!!

哦耶~~从此,再也不用加班,再也不用熬夜,轻轻松松的,就完成了!哈哈~~~~输出A3尺寸的bmp图斑,1000个图斑*5=5000份,只需等待30分钟左右即可输出完成!!!

批量效果预览图:

ARCGIS自动批量导出图片(JPG、BMP、PNG)_第3张图片
ARCGIS自动批量导出图片(JPG、BMP、PNG)_第4张图片
ARCGIS自动批量导出图片(JPG、BMP、PNG)_第5张图片
ARCGIS自动批量导出图片(JPG、BMP、PNG)_第6张图片

附程序代码:

if __name__ == "__main__":

pInput = arcpy.GetParameterAsText(0)

pIndexShp = arcpy.GetParameterAsText(1)

pOutput = arcpy.GetParameterAsText(2)

bOutMJ = arcpy.GetParameterAsText(3)

bAdjustArea = arcpy.GetParameterAsText(4)

strXY = arcpy.GetParameterAsText(5)

if strXY == '#' or not strXY:

strXY = "0.001 Meters" # provide a default value if unspecified

arcpy.env.XYTolerance = strXY

try:

arcpy.AddMessage(HeadInfor)

scd = arcpy.GetInstallInfo()

ArcgisVersion = scd["Version"]

ArcgisProductName = scd["ProductName"]

ArcgisInfo = ("%s %s" % (ArcgisProductName, ArcgisVersion))

arcpy.AddMessage(ArcgisInfo)

date1 = "2022-06-01"

date2 = datetime.datetime.now().strftime("%Y-%m-%d")

if caltime(date1, date2) > 180:

arcpy.AddError("<>")

exit(0)

strCurPath = sys.path[0]

CTempGDB = os.path.join(strCurPath, "pTempDatas.gdb")

arcpy.CreateFileGDB_management(strCurPath, "pTempDatas.gdb")

C_Temp = arcpy.CreateUniqueName("pTempsult", CTempGDB)

arcpy.AddMessage("Start Execute:")

pinFeatures = ("%s #;%s #" % (pInput, pIndexShp))

arcpy.AddMessage("Start Intersect_analysis:")

arcpy.Intersect_analysis(pinFeatures, C_Temp, "ALL", strXY, "INPUT")

arcpy.AddMessage("Start RepairGeometry:")

arcpy.RepairGeometry_management(C_Temp, "DELETE_NULL")

arcpy.AddMessage("Start AddField:")

nMJlenth = 2

if bOutMJ == "true":

nMJlenth = 4

arcpy.AddField_management(C_Temp, "T_MJ", "DOUBLE", 18, nMJlenth, "", "", "NULLABLE", "NON_REQUIRED", "")

arcpy.AddField_management(C_Temp, "CZ_MJ", "DOUBLE", 18, 6, "", "", "NULLABLE", "NON_REQUIRED", "")

arcpy.AddMessage("CalculateField AddField:")

AreaSum0 = GetDecimal('0',0)

AreaSumK1 = GetDecimal('0',0)

AreaSumK2 = GetDecimal('0', 0)

arcpy.AddMessage("Calculat The Old Area:")

if bOutMJ == "true":

SumTotal = sum([row[0] for row in arcpy.da.SearchCursor(pInput, 'SHAPE@AREA')])

AreaSum0 = GetDecimal(GetDecimal(str(SumTotal), nMJlenth) * GetDecimal('0.0001', nMJlenth), nMJlenth)

else:

SumTotal = sum([row[0] for row in arcpy.da.SearchCursor(pInput, 'SHAPE@AREA')])

AreaSum0 = GetDecimal(str(SumTotal), nMJlenth)

arcpy.AddMessage("Calculat The Analize Area:")

with arcpy.da.UpdateCursor(C_Temp, ['SHAPE@AREA','T_MJ','CZ_MJ']) as pCursor:

for pRow in pCursor:

if bOutMJ == "true":

strAreaOld = GetDecimal(str(pRow[0]), 12)

AreaSumK1 = AreaSumK1 + strAreaOld

strArea = GetDecimal(strAreaOld * GetDecimal('0.0001', nMJlenth), nMJlenth)

strAreaCZ = GetDecimal(strAreaOld - strArea * GetDecimal('10000', nMJlenth), 6)

AreaSumK2 = AreaSumK2 + strArea

pRow[1] = strArea

pRow[2] = strAreaCZ

pCursor.updateRow(pRow)

else:

strAreaOld = GetDecimal(str(pRow[0]), 12)

AreaSumK1 = AreaSumK1 + strAreaOld

strArea = GetDecimal(strAreaOld, nMJlenth)

strAreaCZ = GetDecimal(strAreaOld - strArea, 6)

AreaSumK2 = AreaSumK2 + strArea

pRow[1] = strArea

pRow[2] = strAreaCZ

pCursor.updateRow(pRow)

del pRow

del pCursor

if bOutMJ == "true":

AreaSumK1 = GetDecimal(AreaSumK1 * GetDecimal('0.0001', nMJlenth), nMJlenth)

else:

AreaSumK1 = GetDecimal(AreaSumK1, nMJlenth)

# 计算面积(与模板差值)

fCZMJ = AreaSumK1 - AreaSum0

strCZMJ ="topo sub value: {} - {} = {}".format(AreaSumK1, AreaSum0, fCZMJ)

arcpy.AddMessage(strCZMJ)

fCZMJ = AreaSumK2 - AreaSumK1

strCZMJ = "Need Adjust value: {} - {} = {}".format(AreaSumK2, AreaSumK1, fCZMJ)

arcpy.AddMessage(strCZMJ)

if bAdjustArea == "true":

nAdjust = 0

if bOutMJ == "true":

nAdjust = GetDecimal(fCZMJ * GetDecimal('10000', 0), 0)

else:

nAdjust = GetDecimal(fCZMJ * GetDecimal('100', 0), 0)

if fCZMJ > 0:

arcpy.AddMessage("Adjust The Area:")

arcpy.Sort_management(C_Temp, pOutput, "CZ_MJ ASCENDING", "UR")

nCountRecords = 0

with arcpy.da.UpdateCursor(pOutput, ['T_MJ']) as pCursor1:

for pRow1 in pCursor1:

nCountRecords = nCountRecords + 1

if nCountRecords > nAdjust:

break

if bOutMJ == "true":

pRow1[0] = GetDecimal(str(pRow1[0]), nMJlenth) - GetDecimal('0.0001', nMJlenth)

else:

pRow1[0] = GetDecimal(str(pRow1[0]), nMJlenth) - GetDecimal('0.01', nMJlenth)

pCursor1.updateRow(pRow1)

del pRow1

del pCursor1

elif fCZMJ < 0:

arcpy.AddMessage("Adjust The Area:")

nAdjust = nAdjust * GetDecimal('-1', 0)

arcpy.Sort_management(C_Temp, pOutput, "CZ_MJ DESCENDING", "UR")

nCountRecords = 0

with arcpy.da.UpdateCursor(pOutput, ['T_MJ']) as pCursor1:

for pRow1 in pCursor1:

nCountRecords = nCountRecords + 1

if nCountRecords > nAdjust:

break

if bOutMJ == "true":

pRow1[0] = GetDecimal(str(pRow1[0]), nMJlenth) - GetDecimal('0.0001', nMJlenth)

else:

pRow1[0] = GetDecimal(str(pRow1[0]), nMJlenth) - GetDecimal('0.01', nMJlenth)

pCursor1.updateRow(pRow1)

你可能感兴趣的:(arcgis,python,pycharm,windows,小程序)