2

I am automating a process in .Net and calling the ArcGIS CopyFeatures geoprocessing tool multiple times. The source feature class is always in a file geodatabase and the result is always a new shapefile path (guaranteed not to already exist). Each input feature class is in a different location on the Earth.

CopyFeatures always works the first time. Subsequent calls always produce an empty feature class. The output Shapefile has the correct columns but no features. I am destroying and recreating the geoprocessor and CopyFeatures tool objects each time.

I suspect that the GP might be retaining the spatial domain and so subsequent calls filter out the features because the new feature class is in a different location.

Any thoughts on why the output is always empty on subsequent calls to CopyFeatures?

4
  • Without seeing some code I'm only guessing. Are you creating a layer object, and if so are you selecting from the layer to use CopyFeatures? It's possible that nothing is selected after the fist iteration, hence the empty output, but as I said with out seeing some code I'm only guessing. Commented Jan 14, 2015 at 23:30
  • Thanks, I thought about that. No there is no selection
    – narmaps
    Commented Jan 14, 2015 at 23:45
  • 1
    Finally figured this out. It was indeed a spatial domain problem. I now set the "extent" geoprocessing environment variable to the envelope of the input feature class on every call. This works! It's strange because this is very old code that has worked for a long time, but it fails in this one case.
    – narmaps
    Commented Jan 14, 2015 at 23:46
  • How about posting that as an answer (answer your own question) to benefit others with the same problem in the future. Please also include some code. As versions change some situations that the tools were tolerant of they can become intolerant - don't assume that everything is going to work exactly as it did in previous versions (but should be mostly working). That is why upgrading from one version to another is a nightmare for some companies with large code collections! Commented Jan 15, 2015 at 0:17

1 Answer 1

1

Finally figured this out. It was indeed a spatial domain problem. I now set the "extent" geoprocessing environment variable to the envelope of the input feature class on every call. This works! It's strange because this is very old code that has worked for a long time, but it fails in this one case.

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.