Select to view content in your preferred language

Select polygon under feature set point

1908
11
Jump to solution
03-18-2012 08:37 PM
StephenBarrow
Emerging Contributor
Hi

I am trying basically copy the selectlayerbylocation functionality but using a point from a feature set as my input but after trying a few different things I can't get my script to select a polygon under the point in the same way select layer by location does.

Anyone have any idea how to do this under arcpy?
Tags (2)
0 Kudos
11 Replies
JakeSkinner
Esri Esteemed Contributor
Hi Stephen,

Add the following (in bold) to your script.  This will be the same as setting the Output Coordinate System to 'Same as Display'.

import arcpy from arcpy import mapping from arcpy import env  mxd = mapping.MapDocument("CURRENT") df = mapping.ListDataFrames(mxd)[0] spatialReference = df.spatialReference  env.outputCoordinateSystem = spatialReference  # Script arguments Point_Selection = arcpy.GetParameterAsText(0)  Polygon_Selection = arcpy.GetParameterAsText(1)  # Process: Select Layer By Location arcpy.SelectLayerByLocation_management(Polygon_Selection, "INTERSECT", Point_Selection, "", "NEW_SELECTION")  arcpy.RefreshActiveView()
0 Kudos
StephenBarrow
Emerging Contributor
Hi Jake

Works a treat thanks.

Cheers

Stephen
0 Kudos