Geoprocessing failing due to Definition Query

718
2
12-09-2013 11:35 AM
GraceCai
New Contributor
Hi,

I'm attempting to iterate through the layers in a MXD and generate euclidean distance rasters for them. This works fine when the layers have no definition query applied to them. I get this generic COMException when there is a def query applied. Any thoughts? I've also included a bit of source code.

I've tried calling the gp tool in different ways, so far no luck. I haven't had any luck with searching online either.

Error Msg:
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component. at ESRI.ArcGIS.Geoprocessing.GeoProcessorClass.Execute(String Name, IVariantArray ipValues, ITrackCancel pTrackCancel) at Analust.tool.Dummy(IGeoDataset inFeature) in \\C:\Apps\temp\analyst.cs: line 34

IGeoDataset data = (IGeoDataset)layer;
IGeoDataset EucDistRas = null;
IGeoProcessor gp = new GeoProcessorClass();

IVariantArray parameters = new VarArrayClass();
parameters.Add(@"C:\Apps\NTR_Demo\_inputs\NestingSites");
parameters.Add("1000 Meters");

gp.Execute("EucDistance_sa", parameters, null);


Thank you in advance!

Grace
0 Kudos
2 Replies
DuncanHornby
MVP Notable Contributor
If you look at the help for this tool, the distance takes a number but you have entered a string with units.
0 Kudos
JohnStephens
Occasional Contributor
If you look at the help for this tool, the distance takes a number but you have entered a string with units.


And that means whatever the projection of your data is, will be the units of the entered double.

I've come across this before and had to crudely convert degrees to meters.
0 Kudos