private async void Initialize() { // Create a map with a topographic basemap MyMapView.Map = new Map(Basemap.CreateTopographic()); // Set the initial start date for the DatePicker defined in xaml DateTimeOffset myFromDate = new DateTimeOffset(new DateTime(1998, 1, 1)); FromDate.Date = myFromDate; // Set the initial end date for the DatePicker defined in xaml DateTimeOffset myToDate = new DateTimeOffset(new DateTime(1998, 1, 31)); ToDate.Date = myToDate; try { // Create a new geoprocessing task _hotspotTask = await GeoprocessingTask.CreateAsync(new Uri(_hotspotUrl)); } catch (Exception e) { await new MessageDialog(e.ToString(), "Error").ShowAsync(); } }
private async void btnGeoProcess_Click(object sender, RoutedEventArgs e) { //Get the local proprocessing package _gpService = new LocalGeoprocessingService(@"C:\Temp\tile_package_service.gpkx", GeoprocessingServiceType.AsynchronousSubmit); // Start the local service. try { await _gpService.StartAsync(); } catch (Exception exe) { MessageBox.Show(exe.Message); } // If the service is started, get the URL for the specific geoprocessing tool. string gpSvcUrl = _gpService.Url.AbsoluteUri + "/TP_Model"; // Create the geoprocessing task with the URL. _gpTask = await GeoprocessingTask.CreateAsync(new Uri(gpSvcUrl)); GeoprocessingParameters gpParams = new GeoprocessingParameters(GeoprocessingExecutionType.AsynchronousSubmit); //****************************************** //***This is the bit I think is wrong how do I pass a map obkect as a gpstring parameter?**** //********************************************* gpParams.Inputs["Input_Map"] = new GeoprocessingString(MyMapView.Name); _gpJob = _gpTask.CreateJob(gpParams); _gpJob.JobChanged += GeoprocessingJob_JobChanged; _gpJob.Start(); }
private async void Initialize() { // Create and show a map with a topographic basemap. _myMapView.Map = new Map(Basemap.CreateTopographic()); // Create a new geoprocessing task. _hotspotTask = await GeoprocessingTask.CreateAsync(new Uri(HotspotUrl)); }
private async Task <IFeatureSet> GetGeodatabaseVersionsAsync() { // Start animating the activity indicator. _progressBar.StartAnimating(); // Results will be returned as a feature set. IFeatureSet results = null; // Create new geoprocessing task. GeoprocessingTask listVersionsTask = await GeoprocessingTask.CreateAsync(_listVersionsUrl); // Create default parameters that are passed to the geoprocessing task. GeoprocessingParameters listVersionsParameters = await listVersionsTask.CreateDefaultParametersAsync(); // Create job that handles the communication between the application and the geoprocessing task. GeoprocessingJob listVersionsJob = listVersionsTask.CreateJob(listVersionsParameters); try { // Execute analysis and wait for the results. GeoprocessingResult analysisResult = await listVersionsJob.GetResultAsync(); // Get results from the outputs. GeoprocessingFeatures listVersionsResults = (GeoprocessingFeatures)analysisResult.Outputs["Versions"]; // Set results. results = listVersionsResults.Features; } catch (Exception ex) { // Error handling if something goes wrong. if (listVersionsJob.Status == JobStatus.Failed && listVersionsJob.Error != null) { UIAlertController alert = new UIAlertController { Message = "Executing geoprocessing failed. " + listVersionsJob.Error.Message }; alert.ShowViewController(this, this); } else { UIAlertController alert = new UIAlertController { Message = "An error occurred. " + ex }; alert.ShowViewController(this, this); } } finally { // Stop the activity animation. _progressBar.StopAnimating(); } return(results); }
private async void Initialize() { // Create a map with a topographic basemap Map myMap = new Map(Basemap.CreateTopographic()); // Create a new geoprocessing task _hotspotTask = await GeoprocessingTask.CreateAsync(new Uri(_hotspotUrl)); // Assign the map to the MapView MyMapView.Map = myMap; }
private async Task <IFeatureSet> GetGeodatabaseVersionsAsync() { // Results will be returned as a feature set IFeatureSet results = null; // Create new geoprocessing task var listVersionsTask = await GeoprocessingTask.CreateAsync(new Uri(ListVersionsUrl)); // Create parameters that are passed to the used geoprocessing task GeoprocessingParameters listVersionsParameters = new GeoprocessingParameters(GeoprocessingExecutionType.SynchronousExecute); // Create job that handles the communication between the application and the geoprocessing task var listVersionsJob = listVersionsTask.CreateJob(listVersionsParameters); try { // Execute analysis and wait for the results GeoprocessingResult analysisResult = await listVersionsJob.GetResultAsync(); // Get results from the outputs GeoprocessingFeatures listVersionsResults = analysisResult.Outputs["Versions"] as GeoprocessingFeatures; // Set results results = listVersionsResults.Features; } catch (Exception ex) { // Error handling if something goes wrong if (listVersionsJob.Status == JobStatus.Failed && listVersionsJob.Error != null) { var alertBuilder = new AlertDialog.Builder(this); alertBuilder.SetTitle("Geoprocessing error"); alertBuilder.SetMessage("Executing geoprocessing failed. " + listVersionsJob.Error.Message); alertBuilder.Show(); } else { var alertBuilder = new AlertDialog.Builder(this); alertBuilder.SetTitle("Sample error"); alertBuilder.SetMessage("An error occurred. " + ex.ToString()); alertBuilder.Show(); } } finally { // Set the UI to indicate that the geoprocessing is not running SetBusy(false); } return(results); }
private async void Initialize() { // Create a map with a topographic basemap. Map myMap = new Map(Basemap.CreateTopographic()); // Create a new geoprocessing task. _hotspotTask = await GeoprocessingTask.CreateAsync(new Uri(_hotspotUrl)); // Assign the map to the MapView. _myMapView.Map = myMap; // Zoom into Portland, Oregon. await _myMapView.SetViewpointCenterAsync(new MapPoint(-122.66, 45.52, SpatialReferences.Wgs84), 1000000); }
private async Task <IFeatureSet> GetGeodatabaseVersionsAsync() { // Results will be returned as a feature set IFeatureSet results = null; // Create new geoprocessing task var listVersionsTask = await GeoprocessingTask.CreateAsync(ListVersionsUrl); // Create default parameters that are passed to the geoprocessing task GeoprocessingParameters listVersionsParameters = await listVersionsTask.CreateDefaultParametersAsync(); // Create job that handles the communication between the application and the geoprocessing task var listVersionsJob = listVersionsTask.CreateJob(listVersionsParameters); try { // Execute analysis and wait for the results GeoprocessingResult analysisResult = await listVersionsJob.GetResultAsync(); // Get results from the outputs GeoprocessingFeatures listVersionsResults = analysisResult.Outputs["Versions"] as GeoprocessingFeatures; // Set results results = listVersionsResults.Features; } catch (Exception ex) { // Error handling if something goes wrong if (listVersionsJob.Status == JobStatus.Failed && listVersionsJob.Error != null) { UIAlertController alert = new UIAlertController(); alert.Message = "Executing geoprocessing failed. " + listVersionsJob.Error.Message; alert.ShowViewController(this, this); } else { UIAlertController alert = new UIAlertController(); alert.Message = "An error occurred. " + ex.ToString(); alert.ShowViewController(this, this); } } finally { // Set the UI to indicate that the geoprocessing is not running SetBusy(false); } return(results); }
private async void Initialize() { // Create a map with a topographic basemap MyMapView.Map = new Map(Basemap.CreateTopographic()); try { // Create a new geoprocessing task _hotspotTask = await GeoprocessingTask.CreateAsync(new Uri(_hotspotUrl)); } catch (Exception e) { MessageBox.Show(e.ToString(), "Error"); } }
private async void GpServiceOnStatusChanged(object sender, StatusChangedEventArgs statusChangedEventArgs) { // Return if the server hasn't started if (statusChangedEventArgs.Status != LocalServerStatus.Started) { return; } // Create the geoprocessing task from the service _gpTask = await GeoprocessingTask.CreateAsync(new Uri(_gpService.Url + "/Contour")); // Update UI MyUpdateContourButton.IsEnabled = true; MyLoadingIndicator.Visibility = Visibility.Collapsed; }
private async void Initialize() { // Create a map with a topographic basemap MyMapView.Map = new Map(Basemap.CreateTopographic()); try { // Create a new geoprocessing task _hotspotTask = await GeoprocessingTask.CreateAsync(new Uri(_hotspotUrl)); } catch (Exception e) { await Application.Current.MainPage.DisplayAlert("Error", e.ToString(), "OK"); } }
private async void Initialize() { // Create and show a map with a topographic basemap. _myMapView.Map = new Map(Basemap.CreateTopographic()); try { // Create a new geoprocessing task. _hotspotTask = await GeoprocessingTask.CreateAsync(new Uri(HotspotUrl)); } catch (Exception e) { new UIAlertView("Error", e.ToString(), (IUIAlertViewDelegate)null, "OK", null).Show(); } }
private async Task <IFeatureSet> GetGeodatabaseVersionsAsync() { // Results will be returned as a feature set IFeatureSet results = null; // Create new geoprocessing task GeoprocessingTask listVersionsTask = await GeoprocessingTask.CreateAsync(new Uri(ListVersionsUrl)); // Create default parameters that are passed to the geoprocessing task GeoprocessingParameters listVersionsParameters = await listVersionsTask.CreateDefaultParametersAsync(); // Create job that handles the communication between the application and the geoprocessing task GeoprocessingJob listVersionsJob = listVersionsTask.CreateJob(listVersionsParameters); try { // Execute analysis and wait for the results GeoprocessingResult analysisResult = await listVersionsJob.GetResultAsync(); // Get results from the outputs GeoprocessingFeatures listVersionsResults = (GeoprocessingFeatures)analysisResult.Outputs["Versions"]; // Set results results = listVersionsResults.Features; } catch (Exception ex) { // Error handling if something goes wrong if (listVersionsJob.Status == JobStatus.Failed && listVersionsJob.Error != null) { await Application.Current.MainPage.DisplayAlert("Geoprocessing error", "Executing geoprocessing failed. " + listVersionsJob.Error.Message, "OK"); } else { await Application.Current.MainPage.DisplayAlert("Sample error", "An error occurred. " + ex.ToString(), "OK"); } } finally { // Set the UI to indicate that the geoprocessing is not running SetBusy(false); } return(results); }
private async void Initialize() { // Create a map with a topographic basemap. _myMapView.Map = new Map(Basemap.CreateTopographic()); try { // Create a new geoprocessing task. _hotspotTask = await GeoprocessingTask.CreateAsync(new Uri(_hotspotUrl)); // Zoom into Portland, Oregon. await _myMapView.SetViewpointCenterAsync(new MapPoint(-122.66, 45.52, SpatialReferences.Wgs84), 1000000); } catch (Exception e) { new AlertDialog.Builder(this).SetMessage(e.ToString()).SetTitle("Error").Show(); } }
private async void Initialize() { // Create a map with a topographic basemap Map myMap = new Map(Basemap.CreateTopographic()); // Create a new geoprocessing task _hotspotTask = await GeoprocessingTask.CreateAsync(new Uri(_hotspotUrl)); // Assign the map to the MapView MyMapView.Map = myMap; // Set the initial start date for the DatePicker defined in xaml var myFromDate = new DateTimeOffset(new DateTime(1998, 1, 1)); FromDate.Date = myFromDate; // Set the initial end date for the DatePicker defined in xaml var myToDate = new DateTimeOffset(new DateTime(1998, 1, 31)); ToDate.Date = myToDate; }
private async Task CalculateViewshed(MapPoint location) { // This function will define a new geoprocessing task that performs a custom viewshed analysis based upon a // user click on the map and then display the results back as a polygon fill graphics overlay. If there // is a problem with the execution of the geoprocessing task an error message will be displayed // Create new geoprocessing task using the url defined in the member variables section GeoprocessingTask myViewshedTask = await GeoprocessingTask.CreateAsync(new Uri(_viewshedUrl)); // Create a new feature collection table based upon point geometries using the current map view spatial reference FeatureCollectionTable myInputFeatures = new FeatureCollectionTable(new List <Field>(), GeometryType.Point, MyMapView.SpatialReference); // Create a new feature from the feature collection table. It will not have a coordinate location (x,y) yet Feature myInputFeature = myInputFeatures.CreateFeature(); // Assign a physical location to the new point feature based upon where the user clicked in the map view myInputFeature.Geometry = location; // Add the new feature with (x,y) location to the feature collection table await myInputFeatures.AddFeatureAsync(myInputFeature); // Create the parameters that are passed to the used geoprocessing task GeoprocessingParameters myViewshedParameters = new GeoprocessingParameters(GeoprocessingExecutionType.SynchronousExecute) { // Request the output features to use the same SpatialReference as the map view OutputSpatialReference = MyMapView.SpatialReference }; // Add an input location to the geoprocessing parameters myViewshedParameters.Inputs.Add("Input_Observation_Point", new GeoprocessingFeatures(myInputFeatures)); // Create the job that handles the communication between the application and the geoprocessing task GeoprocessingJob myViewshedJob = myViewshedTask.CreateJob(myViewshedParameters); try { // Execute analysis and wait for the results GeoprocessingResult myAnalysisResult = await myViewshedJob.GetResultAsync(); // Get the results from the outputs GeoprocessingFeatures myViewshedResultFeatures = (GeoprocessingFeatures)myAnalysisResult.Outputs["Viewshed_Result"]; // Add all the results as a graphics to the map IFeatureSet myViewshedAreas = myViewshedResultFeatures.Features; foreach (Feature myFeature in myViewshedAreas) { _resultOverlay.Graphics.Add(new Graphic(myFeature.Geometry)); } } catch (Exception ex) { // Display an error message if there is a problem if (myViewshedJob.Status == JobStatus.Failed && myViewshedJob.Error != null) { MessageBox.Show("Executing geoprocessing failed. " + myViewshedJob.Error.Message, "Geoprocessing error"); } else { MessageBox.Show("An error occurred. " + ex.ToString(), "Sample error"); } } finally { // Indicate that the geoprocessing is not running SetBusy(false); } }
private async Task CalculateViewshed(MapPoint location) { // This function will define a new geoprocessing task that performs a custom viewshed analysis based upon a // user click on the map and then display the results back as a polygon fill graphics overlay. If there // is a problem with the execution of the geoprocessing task an error message will be displayed. // Create new geoprocessing task using the URL defined in the member variables section. GeoprocessingTask viewshedTask = await GeoprocessingTask.CreateAsync(new Uri(ViewshedServiceUrl)); // Create a new feature collection table based upon point geometries using the current map view spatial reference. FeatureCollectionTable inputFeatures = new FeatureCollectionTable(new List <Field>(), GeometryType.Point, _myMapView.SpatialReference); // Create a new feature from the feature collection table. It will not have a coordinate location (x,y) yet. Feature inputFeature = inputFeatures.CreateFeature(); // Assign a physical location to the new point feature based upon where the user clicked in the map view. inputFeature.Geometry = location; // Add the new feature with (x,y) location to the feature collection table. await inputFeatures.AddFeatureAsync(inputFeature); // Create the parameters that are passed to the used geoprocessing task. GeoprocessingParameters viewshedParameters = new GeoprocessingParameters(GeoprocessingExecutionType.SynchronousExecute) { OutputSpatialReference = _myMapView.SpatialReference }; // Add an input location to the geoprocessing parameters. viewshedParameters.Inputs.Add("Input_Observation_Point", new GeoprocessingFeatures(inputFeatures)); // Create the job that handles the communication between the application and the geoprocessing task. GeoprocessingJob viewshedJob = viewshedTask.CreateJob(viewshedParameters); try { // Execute analysis and wait for the results. GeoprocessingResult analysisResult = await viewshedJob.GetResultAsync(); // Get the results from the outputs. GeoprocessingFeatures viewshedResultFeatures = (GeoprocessingFeatures)analysisResult.Outputs["Viewshed_Result"]; // Add all the results as a graphics to the map. foreach (Feature feature in viewshedResultFeatures.Features) { _resultOverlay.Graphics.Add(new Graphic(feature.Geometry)); } } catch (Exception ex) { // Display an error message if there is a problem. if (viewshedJob.Status == JobStatus.Failed && viewshedJob.Error != null) { // Report error UIAlertController alert = UIAlertController.Create("Geoprocessing Error", viewshedJob.Error.Message, UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); PresentViewController(alert, true, null); } else { // Report error UIAlertController alert = UIAlertController.Create("Sample Error", ex.ToString(), UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); PresentViewController(alert, true, null); } } }
private async void Initialize() { // Set paths that are relative to execution path string currentDir = Directory.GetCurrentDirectory(); int idx = currentDir.IndexOf("bin") - 1; appRootDir = currentDir.Substring(0, idx); appDataDir = appRootDir + @"\Data"; appTempDir = appRootDir + @"\temp"; // Set up files testImage = appDataDir + @"\sampleFile.tiff"; gpPackage = appDataDir + @"\CreateMapTilePackage.gpkx"; mapPackage = appDataDir + @"\emptyMapPackage.mpkx"; Debug.WriteLine(">> App Root Directory = " + appRootDir); Debug.WriteLine(">> App Data Directory = " + appDataDir); Debug.WriteLine(">> App Temp Directory = " + appTempDir); ////////////// start Q Basket set up ////////////////// // Create raster layer from a raster file (Geotiff) Debug.WriteLine("Loading raster layer from " + testImage); RasterLayer inRasterLayer = new RasterLayer(testImage); // Load Raster into Raster Layer try { await inRasterLayer.LoadAsync(); if (inRasterLayer.LoadStatus != Esri.ArcGISRuntime.LoadStatus.Loaded) { Debug.WriteLine("Error - Input Raster Layer not loaded "); } } catch (Exception ex) { string msg = "Unable to load the raster\n"; msg += "Raster file = " + testImage; msg += "Load status = " + inRasterLayer.LoadStatus.ToString(); msg += "\n\nMessage: " + ex.Message; MessageBox.Show(msg, "inRasterLayer.LoadAsync failed"); } // Create a new EnvelopeBuilder from the full extent of the raster layer. // Add a small zoom to make sure entire map is viewable EnvelopeBuilder envelopeBuilder = new EnvelopeBuilder(inRasterLayer.FullExtent); envelopeBuilder.Expand(0.75); // Create a basemap from the raster layer Basemap baseMap = new Basemap(inRasterLayer); // Create a new map using the new basemap Map newMap = new Map(baseMap); // Set the viewpoint of the map to the proper extent. newMap.InitialViewpoint = new Viewpoint(envelopeBuilder.ToGeometry().Extent); // Create a map and add it to the view MyMapView.Map = newMap; // Load new map to display basemap try { // Add map to the map view. MyMapView.Map = newMap; // Wait for the map to load. await newMap.LoadAsync(); } catch (Exception ex) { string msg = "Unable to load the Map\n"; msg += "\n\nMessage: " + ex.Message; MessageBox.Show(msg, "newMap.LoadAsync failed"); } // Wait for rendering to finish before taking the screenshot for the thumbnail await WaitForRenderCompleteAsync(MyMapView); ////////////// end Q Basket set up ////////////////// // Start the Local Server try { // LocalServer must not be running when setting the data path. if (LocalServer.Instance.Status == LocalServerStatus.Started) { await LocalServer.Instance.StopAsync(); } // Set the local data path - must be done before starting. // Avoid Windows path length limitations (260). // CreateDirectory won't overwrite if it already exists. Directory.CreateDirectory(appTempDir); LocalServer.Instance.AppDataPath = appTempDir; // Start the local server instance await LocalServer.Instance.StartAsync(); MessageBox.Show("Local Server started"); Debug.WriteLine(">> Local Server started"); // Get the URL for the localServer // localhost port is variable localServerURL = LocalServer.Instance.Url.AbsoluteUri; Debug.WriteLine("\n>> Local server url - " + localServerURL); Debug.WriteLine(">> Local server App Data Path - " + LocalServer.Instance.AppDataPath); } catch (Exception ex) { string msg = "Please ensure the local server is installed \nand configured correctly"; msg += String.Format("\nMessage: {0}", ex.Message); MessageBox.Show(msg, "Local Server failed to start"); Debug.WriteLine(msg); App.Current.Shutdown(); } // LOCAL MAP SERVICE INIT // Create and start the local map service try { _localMapService = new LocalMapService(mapPackage); } catch (Exception ex) { string msg = "Cannot create the local map service"; msg += "Map Package = " + mapPackage; msg += String.Format("\nMessage: {0}", ex.Message); MessageBox.Show(msg, "Local Map Server failed to start"); Debug.WriteLine(msg); App.Current.Shutdown(); } // RASTER WORKSPACE CREATION // Create the Raster workspace; this workspace name was chosen arbitrarily // Does workspace need to be the same directory as rasters? // setting to temp directory rasterWorkspace = new RasterWorkspace("raster_wkspc", appTempDir); Debug.WriteLine(">> raster workspace folder = " + rasterWorkspace.FolderPath); Debug.WriteLine(">> raster workspace id = " + rasterWorkspace.Id); // Create the layer source that represents the Raster on disk RasterSublayerSource source = new RasterSublayerSource(rasterWorkspace.Id, testImage); // Create a sublayer instance from the table source _rasterSublayer = new ArcGISMapImageSublayer(0, source); // Add the dynamic workspace to the map service _localMapService.SetDynamicWorkspaces(new List <DynamicWorkspace>() { rasterWorkspace }); // Register map service status chagne event handle _localMapService.StatusChanged += _localMapService_StatusChanged; // Start the map service try { await _localMapService.StartAsync(); } catch (Exception ex) { string msg = "Cannot start the local map service"; msg += "Map Package = " + mapPackage; msg += String.Format("\nMessage: {0}", ex.Message); MessageBox.Show(msg, "Local Map Server failed to start"); Debug.WriteLine(msg); App.Current.Shutdown(); } // Get the url to the local map service localMapServiceURL = _localMapService.Url.AbsoluteUri; MessageBox.Show("Local Map Service URL = " + localMapServiceURL); Debug.WriteLine("Local Map Service URL = " + localMapServiceURL); // LOCAL GEOPROCESSING SERVICE INIT // Create the geoprocessing service _localGPservice = new LocalGeoprocessingService(gpPackage, gpServiceType); // Ass GP service status chagned event handler _localGPservice.StatusChanged += GpServiceOnStatusChanged; // Try to start the service try { // Start the service await _localGPservice.StartAsync(); if (_localGPservice.Status == LocalServerStatus.Failed) { string msg = ("Geoprocessing service failed to start.\n"); MessageBox.Show(msg, "gpService.StartAsync failed"); App.Current.Shutdown(); } else if (_localGPservice.Status == LocalServerStatus.Started) { localGPserviceUrl = _localGPservice.Url.AbsoluteUri + "/CreateMapTilePackage"; string msg = ("Geoprocessing service started.\n"); msg += "\n>> GP Service URL: " + localGPserviceUrl; msg += ">> GP Service Max Records: " + _localGPservice.MaxRecords; msg += ">> GP Service Package Path: " + _localGPservice.PackagePath; msg += ">> GP Service Type: " + _localGPservice.ServiceType; MessageBox.Show(msg, "gpService.StartAsync started"); Debug.WriteLine("\n>> GP Service URL: " + localGPserviceUrl); Debug.WriteLine(">> GP Service Max Records: " + _localGPservice.MaxRecords); Debug.WriteLine(">> GP Service Package Path: " + _localGPservice.PackagePath); Debug.WriteLine(">> GP Service Type: " + _localGPservice.ServiceType); } } catch (Exception ex) { string msg = ("Geoprocessing service failed to start.\n"); msg += "\nGeoprocessing package - " + gpPackage + "\n"; msg += String.Format("\nMessage: {0}", ex.Message); MessageBox.Show(msg, "gpService.StartAsync failed"); return; } // GEOPROCESSING TASK INIT // Create the geoprocessing task from the service try { string url = _localGPservice.Url + "/CreateMapTilePackage"; _gpTask = await GeoprocessingTask.CreateAsync(new Uri(url)); } catch (Exception ex) { string msg = ("Geoprocessing task failed to start.\n"); msg += "\nlocalGPserviceUrl- " + localGPserviceUrl + "\n"; msg += String.Format("\nMessage: {0}", ex.Message); MessageBox.Show(msg, "GeoprocessingTask.CreateAsync failed"); return; } MessageBox.Show("GeoprocessingTask.CreateAsync created"); // GEOPROCESSING JOB // Create the geoprocessing parameters GeoprocessingParameters gpParams = new GeoprocessingParameters(gpExecutionType); // Add the interval parameter to the geoprocessing parameters //GeoprocessingString Input_Map = new GeoprocessingString("MyMapView.Map"); GeoprocessingString Input_Map = new GeoprocessingString("localMapServiceURL"); GeoprocessingDouble Max_LOD = new GeoprocessingDouble(10); GeoprocessingString Output_Package = new GeoprocessingString("C://Karen/Data/TilePackages/test.tpkx"); gpParams.Inputs.Add("Input_Map", Input_Map); gpParams.Inputs.Add("Max_LOD", Max_LOD); gpParams.Inputs.Add("Output_Package", Output_Package); // Create the job try { _gpJob = _gpTask.CreateJob(gpParams); } catch (Exception ex) { string msg = ("Geoprocessing job cannot be created.\n"); msg += String.Format("\nMessage: {0}", ex.Message); MessageBox.Show(msg, "_gpTask.CreateJob failed"); return; } MessageBox.Show("GeoprocessingTask.CreateJob created"); MyLoadingIndicator.Visibility = Visibility.Visible; // Update the UI when job progress changes _gpJob.ProgressChanged += (sender, args) => { Dispatcher.Invoke(() => { MyLoadingIndicator.Value = _gpJob.Progress; }); }; // Be notified when the task completes (or other change happens) _gpJob.JobChanged += GpJobOnJobChanged; // Start the job try { _gpJob.Start(); } catch (Exception ex) { string msg = ("Geoprocessing start job failed to start.\n"); msg += String.Format("\nMessage: {0}", ex.Message); MessageBox.Show(msg, "_gpjob.Start failed"); return; } MessageBox.Show("GeoprocessingTask job started"); }