Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Flash Selected Feature?

$
0
0
Anyone know how to Flash a Selected Feature using Python or to call the ArcObjects function through Python?

I have a process set up to allow the user to easily Query a Layer and then Zoom to the Selected Feature, immediately after zooming to the feature though, I want the feature to Flash the same as it would through the Identify Window in order to draw the user's attention to it.

I tried creating a crude version of it using SelectLayerByAttribute, but it's god-awful slow.
Code:

def crudeFlash(FeatureLayer, Query):
    mxd = arcpy.mapping.MapDocument("Current")
    df = arcpy.mapping.ListDataFrames(mxd)[0]
    arcpy.SelectLayerByAttribute_management(FeatureLayer, "NEW_SELECTION", Query)
    df.zoomToSelectedFeatures()
    arcpy.SelectLayerByAttribute_management(FeatureLayer, "CLEAR_SELECTION")
    arcpy.SelectLayerByAttribute_management(FeatureLayer, "NEW_SELECTION", Query)
    arcpy.SelectLayerByAttribute_management(FeatureLayer, "CLEAR_SELECTION")
   
>>> crudeFlash("MyLayer", '"NAME" = ' + "'MyFeature'")

The reason I don't want to just leave the feature selected is that I don't want to create a situation where the User might then run some sort of GeoProcess and it only executes against the single selected feature.

Viewing all articles
Browse latest Browse all 2485

Trending Articles