编程语言
首页 > 编程语言> > arcgis python RefreshActiveView CLEAR_SELECTION

arcgis python RefreshActiveView CLEAR_SELECTION

作者:互联网

import arcpy

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
lyr = arcpy.mapping.ListLayers(mxd, "Cities", df)[0]

# Use the SelectLayerByAttribute tool to select New York and 
#  zoom to the selection
arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", 
                                        "CITY_NAME = 'New York'")
df.zoomToSelectedFeatures()

# Export the map to a .jpg
arcpy.mapping.ExportToJPEG(mxd, "C:/data/NewYork.jpg")

# Clear the selection and refresh the active view
arcpy.SelectLayerByAttribute_management(lyr, "CLEAR_SELECTION")
arcpy.RefreshActiveView()

del mxd

 

标签:SelectLayerByAttribute,lyr,python,CLEAR,mapping,arcgis,df,mxd,arcpy
来源: https://www.cnblogs.com/gisoracle/p/10934301.html