2

I've got two large feature classes that I'm trying to perform an intersect on. Using the following python code, I get an empty output feature class:

arcpy.Intersect_analysis(["Schools","Zips"], "Intersect_output","ALL")

Yet when I use the Intersect_analysis tool from the arcMap toolbox with these same two feature classes, it performs the intersect as expected. I've used the above code as part of a script that intersects a whole bunch of feature class pairs, and it does fine with most of them, but not these two feature classes in particular.

Can anyone think of a reason that these feature classes in particular might fail where others succeeded? I can't post the data, unfortunately, as I am not authorized to distribute it.

UPDATES:

Some more information: *The failure now appears to be intermittent. After running code above exactly as shown in the arcmap python interpreter, it failed. I entered the exact same code (changing only the output feature class name, and this time it generated the correct intersect. I didn't touch the data, nor did I change the code, nor did I even close the python window between runs. it seems completely random. Has anyone ever encountered this behavior before? Might this be an arcpy bug?

*Both feature classes are using the exact same coordinate system.

*I have a separate script that calls the line of code above, but I'm testing it in the arcmap python interpreter, and I has failed there as well.

closed as off-topic by PolyGeo Jan 3 '15 at 9:07

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Are you defining an arcpy.env.workspace for these layers? – artwork21 Dec 17 '14 at 21:26
  • 2
    Can you post your script? – Aaron Dec 17 '14 at 21:39
  • 1
    Are their coordinate systems different? In ArcMap it is possible to apply a transformation but this cannot be done in arcpy (that I know of), if the coordinate systems are different there could be an empty intersection due to confusion over spatial reference. p.s. as Aaron asked, more script please, just in case there is a problem on another line. – Michael Stimson Dec 17 '14 at 21:46
  • 1
    The next thing to look at is bad geometries, use Repair Geometry to fix them before running the script. – Michael Stimson Dec 17 '14 at 22:20
  • 1
    I think it is time to close all applications of ArcGIS for Desktop, reboot if possible, and then try to perform the same steps that are currently giving you unexpected results - starting with the simplest scenario of running it from the Python window of ArcMap. – PolyGeo Dec 17 '14 at 22:47