I'm working for a GAS utility, I have Pipe Exposures (Points) and they are snapped to either a Main(line) or a Service (Line).
Using ArcPy I've tried to do a intersect with a try/except block, if try the service and if not try the main. Along the way set a variable to let me know which layer it's on. It's part of editing, as each gets different values. My code snippet below:
try:
arcpy.Intersect_analysis('Pipexposure #;Service #', PipeExposure_Intersect, "ONLY_FID", "", "INPUT")
theLayer = "the Service"
except:
arcpy.Intersect_analysis('PipeExposure #;DistributionMain #', PipeExposure_Intersect, "ONLY_FID", "", "INPUT")
theLayer = "the Main"
arcpy.AddMessage('The Pipe Exposure is on '+ theLayer)
No matter what I put a point on, it returns on the Main. I'm stumped and wondering if there is a better way to determine what layer is intersected. I do have an "Exists/than Delete" for my in_memory/PipeExposure_Intersect FeatureClass. that runs before I check.