Select to view content in your preferred language

Problem setting the extent on the geoprocessor

395
0
03-17-2011 08:29 AM
OllieNewman
Emerging Contributor
I am having trouble setting the extent environment value for the geoprocessor using C#.  I have the following code

ESRI.ArcGIS.Geoprocessor.Geoprocessor gp = new ESRI.ArcGIS.Geoprocessor.Geoprocessor();
gp.SetEnvironmentValue("extent", "30 30 50 50");
ESRI.ArcGIS.ConversionTools.FeatureClassToFeatureClass featureTofeature = new ESRI.ArcGIS.ConversionTools.FeatureClassToFeatureClass();
featureTofeature.in_features = connectionFile + "\\" + featureClassName;
featureTofeature.out_path = saveDirectoryPath;
featureTofeature.out_name = featureExportName;
featureTofeature.where_clause = query.WhereClause;
IGeoProcessorResult result = (IGeoProcessorResult)gp.Execute(featureTofeature, null);


The result is that it exports all features and ignores the extent.  If I run the same tool with the same inputs through ArcCatalog then it works as expected so the FeatureClassToFeatureClass tool should make use of the extent environment variable.  Can anyone see what I have missed here?

Thanks.

EDIT:  Some more investigation has revealed that if I comment out the where_clause then it does work as expected (I confess that I didn't fill out the where clause when running the tool through ArcCatalog), so how can I use both an extent and a where clause?
0 Kudos
0 Replies