Ok, the sample GPK is uploaded. You should be able to get to it here:https://betacommunity.esri.com/files/download.aspx/PointToPointWBarriers.gpk?d=0D08C5CF1E0B4D2380C5ABB16FBDB958&p=18BC10576E2C4606AFED3A8870BFE445&n=2D260C03AB1F498F90DB735EFC041782&s=A76CF05EFE6B4517B249DD9403507710&l=66974DEB93534385A83D793393E1F9F4Only members of the Beta Community will be able to access it. Let me know if you have troubles.
Hi James,You�??re not doing anything wrong, at this time the Runtime does not support the RouteTask with local resources. Routing is supported by geoprocessing model and then creating a Geoprocessing Package (gpk) with runtime support enabled from that model. We are looking into adding this support in the future.
Bump to make sure you didn't miss my response two post above.Thanks,James
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); } } } }
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.
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
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.