2

I'm trying to run some geoprocessing functions in ArcObjects. Some of the tools I want to use are part of the spatial analyst extension. In 9.3.1 it was fairly straightforward to follow the documentation and execute geoprocessing tools in ArcObjects. In ArcGIS it seems all the spatial analyst tools are only available through the arcpy.sa site package. The tools still exist in the arctoolbox with a standard parameter for the output raster. But all the documentation on the tools show the output as a raster object not a standard parameter. When I try and execute the tool in ArcObjects it fails because it doesn't expect a return and as far as I can tell there is no parameter for the output raster. Anyone trying to run spatial analyst geoprocessing tools from ArcObjects in 10?

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Sep 30, 2010 at 15:17
1
  • I am not sure why you cannot run the Geoprocessing tools using ArcObjects. Can you share the code that you are running? If that is not possible, can you run the code given in AndOne's reply? Commented Oct 21, 2010 at 11:51

3 Answers 3

2

Are you using the (relatively) new Geoprocessor class?

Geoprocessor gp = new Geoprocessor();
RasterToPolygon r2p = new RasterToPolygon();
r2p.in_raster = "myRaster";
r2p.out_polygon_features = "myPolygon";
r2p.simplify = "NO_SIMPLIFY";
IGeoProcessorResult result = gp.Execute(r2p, null) as IGeoProcessorResult;

If you look at the geoprocessor library of AO you will find the Spatial Analyst tools, too.

answered Oct 21, 2010 at 8:25
0

If all you are trying to do is to use existing Spatial Analyst's functions, and the sole motivation in doing this is to automate your geo processing through scripting, then i would suggest using the arcpy Python framework, as it is a lot easier to work with.

answered Oct 5, 2010 at 22:28
1
  • I am coming to that conclusion as well. I have some other customizations I was planning on in ArcMap that will need to be done in ArcObjects and I wanted to keep everything in a single toolbar. But geoprocessing and spatial analyst tasks are indeed quicker to code in python. Thanks very much for your input. Commented Oct 6, 2010 at 14:03
0

Just a thought; you could build a model then run it from within a procedure.

answered Oct 9, 2010 at 2:10
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.