I am using ArcGIS Pro 2.6.

I am looking for a quick and dirty test that returns a Boolean to see if any ArcPy Point that I create is within a feature class.

Unfortunately, it seems that feature classes aren't supported with the arcpy.Point.within() method, and instead they use geometries (https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/point.htm).

Converting from a feature class to a geometry seems pretty cumbersome for my purposes (https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-convert-selected-feature-from-feature-class/td-p/776571), and it feels like there must be a tool to do what I want.

There was a similar question in this Esri Community thread (https://community.esri.com/t5/python-questions/how-to-use-the-geometry-within-function-in-arcpy/td-p/66834), but the central question went unanswered.

This pseudo code is how I'd want things to work:

fc = pathToFeatureClass
withinValue = arcpy.Point(1,1).within(fc)

if withinValue == True:
  do something
  do another thing
  • Regarding the statement, "it seems that feature classes aren't supported with the arcpy.Point.within() method," none of the ArcPy Geometry methods support working on feature classes. For working with sets of geometries, e.g., feature classes, it is best to work with geoprocessing tools that are designed and optimized to work on sets of geometries.
    – bixb0012
    Apr 3, 2022 at 17:14

2 Answers 2


To retrieve a list of geometries from a feature class you can do:

geoms = arcpy.CopyFeatures_management(fc, arcpy.Geometry())

then test against each of the resulting geometries in that list.

Just note that using geometry methods doesn't take advantage of any spatial indexing that you might otherwise get for free using tools like Spatial Join.

  • 1
    Better to Select first, then CopyFeatures if the selection set is non-empty.
    – Vince
    Dec 14, 2021 at 19:54
  • Thank you Mike, seems like there's a step I'm missing here. Seems like geoms = arcpy.CopyFeatures_management(fc, arcpy.Geometry()) returns a path as a string, and using arcpy.Describe is getting me nowhwere in finding the list of geometries you're talking about? point.within(geoms) errors out since it's just trying to input a string. Dec 14, 2021 at 20:23
  • Odd, is it the input path or a new one? Which version of Arc are you on?
    – mikewatt
    Dec 14, 2021 at 22:24
  • A new one, seems to reflect the path to the created geometry? imgur.com/a/e1Xuzlr Pro 2.8 Dec 14, 2021 at 22:38
  • Very odd. Does type(geometries) actually return str? Wondering if it's a repr thing and the IDE is just showing the stringified version. You could also grab the geometries via a cursor but this is normally a handy shortcut...
    – mikewatt
    Dec 14, 2021 at 23:18

Here is a workaround. Instead of using the within function on the geometry, do a select by location. It's a few more steps, but should produce what you're after.

This assumes your feature class and point coordinates are using the same coordinate system.

fc = pathToFeatureClass
lyr = arcpy.MakeFeatureLayer_management(fc, "lyr")
point = arcpy.Point(1,1)

arcpy.SelectLayerByLocation_management(lyr, "INTERSECT", point, selection_type="NEW_SELECTION")

if len(arcpy.Describe(lyr).FIDSet) > 0:
  do something
  do another thing

# clear the selection
arcpy.SelectLayerByAttribute_management(lyr, "CLEAR_SELECTION")
  • thank you very much! Dec 16, 2021 at 5:34
  • @Dan, did you try running the code you posted? With the current version of ArcGIS Pro (2.9.2), the Select Layer By Location line generates ERROR 000623: Invalid value type for parameter select_features because an ArcPy Point is not a geometry object and Select Layer By Location requires the select_features to be geometries.
    – bixb0012
    Apr 3, 2022 at 17:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.