Last active
April 6, 2017 12:00
-
-
Save BrunoCaimar/b3a29b4eb6a69e73935bc78e7b33481e to your computer and use it in GitHub Desktop.
Running a geoprocess inside C# (AO)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void SampleCalculateBestPathToolGping() | |
| { | |
| // Initialize the geoprocessor. | |
| IGeoProcessor2 gp=new GeoProcessorClass(); | |
| // Add the BestPath toolbox. | |
| gp.AddToolbox(@"C:\SanDiego\BestPath.tbx"); | |
| // Generate the array of parameters. | |
| IVariantArray parameters=new VarArrayClass(); | |
| parameters.Add(@"C:\SanDiego\source.shp"); | |
| parameters.Add(@"C:\SanDiego\destination.shp"); | |
| parameters.Add(@"C:\SanDiego\bestpath.shp"); | |
| object sev=null; | |
| try | |
| { | |
| // Execute the model tool by name. | |
| gp.Execute("CalculateBestPath", parameters, null); | |
| Console.WriteLine(gp.GetMessages(ref sev)); | |
| } | |
| catch (Exception) | |
| { | |
| // Print geoprocessing execution error messages. | |
| Console.WriteLine(gp.GetMessages(ref sev)); | |
| throw; | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#c4ff8b68-0410-435f-b8e5-682d5cea47cf.htm