Geoprocessing Locate Features Along Routes

815
4
11-05-2019 10:02 AM
ScottKempin
New Contributor

I have tried to match the python syntax for calling the Locate Features Along Routes tool. However, I am unable to get the tool to adhere to the properties I am trying to implement in the props string. I assume this is a syntax error but I seem to have tried everything. Any ideas?

//Locate structures along stream routes
string urlStreamRoutes = defaultGdbPath + "\\StreamRoutes";
string urlStructTable = defaultGdbPath + "\\StructureStationing";
var props = "rkey LINE fmp tmp";
var locateArgs = Geoprocessing.MakeValueArray(urlStructBuffer, urlStreamRoutes, streamRouteId, "1 feet", urlStructTable, props, "#", "#", "NO_ZERO", "FIELDS", "M_DIRECTION");
//var locateStructs = await QueuedTask.Run(() => { return Geoprocessing.ExecuteToolAsync("LocateFeaturesAlongRoutes_lr", locateArgs); });
Geoprocessing.OpenToolDialog("LocateFeaturesAlongRoutes_lr", locateArgs);

0 Kudos
4 Replies
ScottKempin
New Contributor

Rich Ruh‌ any ideas?

0 Kudos
RichRuh
Esri Regular Contributor

This is outside of my area of expertise, but I'm trying to track down someone who can help.

--Rich

0 Kudos
ScottKempin
New Contributor

Thanks Rich, I appreciate the help.

0 Kudos
NobbirAhmed
Esri Regular Contributor

Follow the code snippets in the Concepts page:

ProConcepts Geoprocessing · Esri/arcgis-pro-sdk Wiki · GitHub 

The code snippet for opening a tool dialog is (available in the above link):

string input_points = @"C:\data\ca_ozone.gdb\ozone_points";
string output_polys = @"C:\data\ca_ozone.gdb\ozone_buff";
string buffer_dist = "";

var param_values = Geoprocessing.MakeValueArray(input_points, output_polys, buffer_dist);  

Geoprocessing.OpenToolDialog("analysis.Buffer", param_values);

As the execution runs Asynchronously, you need to use "await" keyword:

// get the model tool's parameter syntax from the model's help 
string input_roads = @"C:\data\Input.gdb\PlanA_Roads";
string buff_dist_field = "Distance";   // use the distance values from a field named Distance
string input_vegetation = @"C:\data\Input.gdb\vegtype";
string output_data = @"C:\data\Output.gdb\ClippedFC2"; 

string tool_path = @"C:\data\CompletedModels.tbx\ExtractVegetationforProposedRoads"; 
var args = Geoprocessing.MakeValueArray(input_roads, buff_dist_field, input_vegetation, output_data); 
var result = await Geoprocessing.ExecuteToolAsync(tool_path, args);