当前位置:网站首页>ArcGIS batch render layer script

ArcGIS batch render layer script

2022-06-26 14:23:00 Chaoying.

Script files render.py

import arcpy


def renderbatch(rlayer):
    # rLayer arcpy.mapping.Layer
    rtype = None
    if rlayer.isFeatureLayer:
        rtype = 0
    elif rlayer.isRasterLayer:
        rtype = 1
    else:
        arcpy.AddMessage("Reference Layer can only be feature layer or raster layer!")
        return
    mxd = arcpy.mapping.MapDocument('CURRENT')
    df = arcpy.mapping.ListDataFrames(mxd)[0]
    layers = arcpy.mapping.ListLayers(mxd, data_frame=df)
    for layer in layers:
        stype = None
        if layer.isFeatureLayer:
            stype = 0
        elif layer.isRasterLayer:
            stype = 1
        else:
            continue
        if stype == rtype:
            arcpy.mapping.UpdateLayer(df, layer, rlayer, True)
            pass


rLayer = arcpy.GetParameter(0)
renderbatch(rLayer)
arcpy.AddMessage("finished!")

stay Arcgis Add this script to

 Insert picture description here

 Insert picture description here

  •  Insert picture description here
  • Add script parameters
     Insert picture description here
  • Tool operation interface
  •  Insert picture description here
原网站

版权声明
本文为[Chaoying.]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202170508310809.html