Select to view content in your preferred language

Clearing Selected features in mxd

3910
5
Jump to solution
05-29-2015 03:13 PM
JohnHaynes
New Contributor

I am using ArcGIS 10,3 and I am trying to create a python script that will automate a mapping process.  I have point feature classes and polygon feature classes.  I have used MakeFeatureLayer_management to create layers.  I then use SelectLayerByLocation to select the polygon that INTERSECTS with the point layer and then I add both the point layer and polygon to the mxd.  Once I have them there, I then zoomToSelectedFeatures.  I am having trouble clearing the selected features once they have been added to the mxd prior to my exporting the mxd to a pdf.  Any help would be appreciated.

JD

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
IanMurray
Honored Contributor

arcpy.SelectLayerByAttribute_management(Layer, "CLEAR_SELECTION")

arcpy.RefreshActiveView()

View solution in original post

5 Replies
IanMurray
Honored Contributor

arcpy.SelectLayerByAttribute_management(Layer, "CLEAR_SELECTION")

arcpy.RefreshActiveView()

DarrenWiens2
MVP Honored Contributor

Untested, but I believe you can run Select Layer By Attribute, specifying CLEAR_SELECTION as the selection type.

IanMurray
Honored Contributor

Tested many many time previously and works.

IanMurray
Honored Contributor

That is a workflow that I have had to set up as well.  Have a few maps templates, have to loop through each record in a polygon feature class, zoom to the feature, use attribute data to control text elements on my map, then export out to chosen output type on each template. 

JohnHaynes
New Contributor

Ian,

Thank you very much this was very helpful.  I had trouble at first using the arcpy.SelectLayerByAttribute_management right after I had added the layer and zoomToSelectedFeatures.  What I ended up doing was to use a "for loop" to go through the layers in a TOCLayer list and used an "if" statement to clear it there.  Not sure if this is the most efficient way to do this, but it is working now.  Thanks!

0 Kudos