Hi Ralf,
This is very helpful. I was able to basically reproduce the model example in the screenshot you provided, and I added a couple stops to my network analyst toolbar in ArcMap so that it would run. As you can see, it sees the two stops I provided, it says it ran successfully, but it doesn't put a result in the results window for me to be able to export. Am I missing something here on this last piece?
Thanks,
James
Right-click on them in Model Builder, select Properties, Data Type tab select a Feature Set as the data type, and import the schema from a point feature class. (A blank one with the correct spatial reference is probably best for the initial test.)
Now when you double click on your Model in ArcMap, you will see your Feature Set Parameters get added as Layers to your map. Click on each parameter in the GP tool dialog and populate the parameters. Then run the tool. You should see a resulting route produced on the map.
With creating the geoprocessor service via the gpk from your description above, am I correct in that the RouteTask will only work with ESRI's routing service, and that we will need to use GeoProcessor.Execute instead for our own custom routing by supplying the necessary GPParameter list that corresponds to what the REST service call expects as input parameters to create a route?
Also, if the file is too big to post here, feel free to post on the ftp that I provided to you; if you don't mind.
Thanks,
Mike
{ LocalGeoprocessingService pointToPoint = new LocalGeoprocessingService(@"MyGPK.gpk", GPServiceType.Execute); pointToPoint.StartAsync((x) => { if (x.Error != null) MessageBox.Show("Error creating local GP service:\n" + x.Error.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); }); } // Write some code to populate input Graphics either from a geocode or whatever you like. // { // { // Execute the tool { Geoprocessor gp = new Geoprocessor(pointToPoint.UrlGeoprocessingService + "/PointToPointWBarriers"); gp.ExecuteCompleted += new System.EventHandler<GPExecuteCompleteEventArgs>(gp_ExecuteCompleted); gp.Failed += new System.EventHandler<TaskFailedEventArgs>(gp_Failed); List<GPParameter> parameters = new List<GPParameter>(); FeatureSet featureSet = new FeatureSet(); featureSet.Features.Add(startPoint); featureSet.Features.Add(endPoint); GPFeatureRecordSetLayer inutFeatures = new GPFeatureRecordSetLayer("Input_Locations", featureSet); parameters.Add(inutFeatures); } void gp_ExecuteCompleted(object sender, GPExecuteCompleteEventArgs e) { foreach (GPParameter outParameter in e.Results.OutParameters) { if (outParameter is GPFeatureRecordSetLayer) { GPFeatureRecordSetLayer outputFeatures = outParameter as GPFeatureRecordSetLayer; foreach (Graphic graphic in outputFeatures.FeatureSet) { graphic.Symbol = this.Resources["LineSymbol"] as ESRI.ArcGIS.Client.Symbols.SimpleLineSymbol; graphicsLayer.Graphics.Add(graphic); } } } }
Bump to make sure you didn't miss my response two post above.
Thanks,
James