ArcGIS批量导出图层脚本

该脚本会将ArcMap中的每一个图层单独导出为图片

import arcpy
import os


def exportbatch(outdir, export_width, export_height, resolution):
    # outdir the directory to store the exported pngs
    mxd = arcpy.mapping.MapDocument('CURRENT')
    df = arcpy.mapping.ListDataFrames(mxd)[0]
    layers = arcpy.mapping.ListLayers(mxd, data_frame=df)
    for layer in layers:
        for lay in layers:
            lay.visible = False
        layer.visible = True
        filename = layer.name
        if filename.endswith('tif'):
            filename = filename[0:-4]
        filename += '.tif'
        outpath = os.path.join(outdir, filename)
        arcpy.mapping.ExportToTIFF(map_document=mxd, out_tiff=outpath, data_frame=df, df_export_width=export_width,
                                   df_export_height=export_height, resolution=resolution, tiff_compression='LZW')

    arcpy.AddMessage('Export gas beed finised!')


outdir = arcpy.GetParameterAsText(0)
export_width = arcpy.GetParameter(1)
export_height = arcpy.GetParameter(2)
resolution = arcpy.GetParameter(3)
exportbatch(outdir, export_width, export_height, resolution)

脚本添加方式参考ArcGIS批量渲染图层脚本

脚本参数设置如下:
在这里插入图片描述

  • 工具运行界面
    在这里插入图片描述
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值