Select to view content in your preferred language

local runtime spatial analysis problem

3208
0
09-09-2015 03:30 AM
Durga_PrasadD
Deactivated User

Trying to run a geoprocessing task as in this example.The tool fails when submitted for execution with below error

"System.ArgumentException: Only 'http' and 'https' schemes are allowed.\r\nParameter name: requestUri\r\n   at System.Net.Http.HttpRequestMessage.InitializeValues(HttpMethod method, Uri requestUri)\r\n   at System.Net.Http.HttpRequestMessage..ctor(HttpMethod method, Uri requestUri)\r\n   at System.Net.Http.HttpClient.GetAsync(Uri requestUri, HttpCompletionOption completionOption, CancellationToken cancellationToken)\r\n   at Esri.ArcGISRuntime.Http.ArcGISHttpClient.GetOrPostAsync(String requestUri, IEnumerable`1 parameters, CancellationToken cancellationToken, Boolean forcePost, HttpCompletionOption completionOption)\r\n   at Esri.ArcGISRuntime.Tasks.Geoprocessing.Geoprocessor.<ExecuteInternal>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at ArcGISRuntimeSDKDotNet_DesktopSamples.Samples.MyRaster.<ViewshedButton_Click>d__5.MoveNext() in C:\\Raster1\\Contour\\MainWindow.xaml.cs:line 82"

private string gpkPath = @"C:\sapyexamples\contour\contour.gpk";

private string gpUrl = string.Empty;   

try

            {

                var gpService = new Esri.ArcGISRuntime.LocalServices.LocalGeoprocessingService(gpkPath, GeoprocessingServiceType.SubmitJobWithMapServerResult);

                await gpService.StartAsync();

                gpUrl = gpService.UrlGeoprocessingService;

                var taskName = "contour";

                // create Geoprocessor

                var gp = new Geoprocessor(new Uri(gpkPath + "/" + taskName));

                // set up the parameters - see serviceURL for parameter info

                var parameter = new GPInputParameter();

                var tifFile  = new GPString("elevation", @"..\..\raster\contourdata.gdb\elevation");

                var interval = new GPString("Interval", "400");                            

                var shpFile = new GPString("Contour_Result", @"..\..\vector\scratch.gdb\aaaa.shp");

                // add GPParameters to the parameter collection

                parameter.GPParameters.Add(tifFile);

                parameter.GPParameters.Add(interval);

                parameter.GPParameters.Add(shpFile);  

                var result = await gp.ExecuteAsync(parameter);//FAILS HERE

                MessageBox.Show("Success");

            }

            catch (Exception ex)

            {

                MessageBox.Show("No Luck");

                MessageBox.Show(ex.ToString());

            }

0 Kudos
0 Replies