I'm trying to do an intersect analysis,

# Intersect(in_features, out_feature_class, {join_attributes}, {cluster_tolerance}, {output_type})
arcpy.Intersect_analysis(layer1, output)

but I can't see how to further refine the analysis based on attributes?

layer 1 is events, and being compared against a layer of maintenance activities. When maintenance activities are finished, they are no longer relevant. So how do I want to find intersections between the two layers, where status of maintenance <> 'complete'?


2 Answers 2


Use arcpy.MakeFeatureLayer_management with a where_clause.

If you do this before you intersect, your intersect should be quicker as there's less data to process

  • And a more complex criteria? Lets say events and maintenance have a start date and end date. Anything happening in the same location more than a year apart, is not an intersection. Both input feature class or layer have start date / end data attributes.
    – Maxcot
    Jun 24, 2020 at 0:45
  • 1
  • yep, I see that. But I cannot see how to say the equivalent in SQL of startdate of any two items within 12 months of another item
    – Maxcot
    Jun 24, 2020 at 2:12
  • I would if I could. Guess I'll have to wait until next week.
    – Maxcot
    Jun 24, 2020 at 3:13

SQL Server has this native capability in the STOverlaps function. No python needed


SELECT top 10
  a.Column1 as 'Column1Name',
  a.Column2 as 'Column2Name',
  a.Start_Date as 'aStartDate',
  a.End_Date as 'aEndDate'
  b.Start_Date as 'bStartDate',
  b.End_Date as 'bEndDate'

    tablename a
    inner join tablename b 
    on a.SHAPE.STOverlaps(b.SHAPE) = 1

    aStartDate between bStartDate and bEndDate

Your Answer

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

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