### Start Local Server Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/WPF/WPF.Viewer/Samples/LocalServer/LocalServerGeoprocessing/readme.md Initializes and starts the local server instance. Ensure the server is running before attempting to start geoprocessing services. ```csharp await LocalServer.Instance.StartAsync(); ``` -------------------------------- ### Create and Start Geoprocessing Job Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/WPF/WPF.Viewer/Samples/LocalServer/LocalServerGeoprocessing/readme.md Creates and starts a geoprocessing job with the defined parameters. The job will execute the geoprocessing task on the local server. ```csharp var gpJob = await geoprocessingTask.CreateJobAsync(gpParams); gpJob.Start(); ``` -------------------------------- ### Start Creating a Geometry Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/WPF/WPF.Viewer/Samples/Geometry/SnapGeometryEdits/readme.md Initiates the Geometry Editor to allow the user to create a new geometry of a specified type. ```csharp await editor.StartAsync(GeometryType.Polyline); ``` -------------------------------- ### Get Contingent Values for a Field Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/MAUI/Maui.Samples/Samples/Data/AddFeaturesWithContingentValues/readme.md Retrieve valid contingent values for a specific field based on the current attribute values of a feature. This is crucial for guiding user input. ```csharp ContingentValuesResult contingentValuesResult = await featureTable.GetContingentValues(newFeature, fieldName); if (contingentValuesResult != null) { // Access contingent values based on field group if (contingentValuesResult.ContingentValuesByFieldGroup.TryGetValue(fieldGroupName, out IReadOnlyList contingentValues)) { // Process contingentValues (ContingentCodedValue or ContingentRangeValue) } } ``` -------------------------------- ### Create and load a Geodatabase Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/MAUI/Maui.Samples/Samples/Layers/FeatureLayerDictionaryRenderer/readme.md Instantiate a Geodatabase from a given path and load it asynchronously. Ensure the geodatabase is fully loaded before proceeding. ```csharp var geodatabase = new Geodatabase(geodatabasePath); await geodatabase.LoadAsync(); ``` -------------------------------- ### Get ServiceFeatureTable from sublayer Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Layers/MapImageSublayerQuery/readme.md Access the ServiceFeatureTable from an ArcGISMapImageSublayer to enable feature querying. Ensure the sublayer is loaded before attempting to get its table. ```csharp ServiceFeatureTable sublayerTable = await sublayer.GetTableAsync(); ``` -------------------------------- ### Create and load a Geodatabase Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/WPF/WPF.Viewer/Samples/Layers/FeatureLayerDictionaryRenderer/readme.md Instantiate a Geodatabase from a specified path and load it asynchronously. Ensure the geodatabase is fully loaded before proceeding. ```csharp Geodatabase geodatabase = new Geodatabase(geodatabasePath); await geodatabase.LoadAsync(); ``` -------------------------------- ### Initialize Geometry Editor and Map Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/WPF/WPF.Viewer/Samples/Geometry/SnapGeometryEdits/readme.md Sets up the map and connects it to the MapView, then creates and connects a GeometryEditor. Ensure FeatureTilingMode is enabled for optimal performance. ```csharp Map map = new Map(BasemapStyle.ArcGISImagery); map.LoadSettings.FeatureTilingMode = FeatureTilingMode.EnabledWithFullResolutionWhenSupported; Mvvm.MapView.Map = map; GeometryEditor editor = new GeometryEditor(); await editor.LoadAsync(Mvvm.MapView); ``` -------------------------------- ### Start Local Geoprocessing Service Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/WPF/WPF.Viewer/Samples/LocalServer/LocalServerGeoprocessing/readme.md Starts a local geoprocessing service for tasks like contour generation. This service must be running to execute geoprocessing tasks. ```csharp var service = new LocalGeoprocessingService(new Uri("path/to/Contour.gpkx"), LocalGeoprocessingService.ServiceType.Contour); await service.StartAsync(); ``` -------------------------------- ### Configure Route Parameters for Solving Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/WinUI/ArcGIS.WinUI.Viewer/Samples/NetworkAnalysis/RouteAroundBarriers/readme.md Configure route parameters, including returning stops and directions, setting stops and barriers, and specifying sequence options. ```csharp // Configure route parameters. routeParameters.ReturnStops = true; routeParameters.ReturnDirections = true; // Set stops from graphics. var routeStops = stopsGraphicsOverlay.Graphics.Select(graphic => graphic.Geometry as MapPoint).ToList(); routeParameters.SetStops(routeStops); // Set polygon barriers from graphics. var routeBarriers = barriersGraphicsOverlay.Graphics.Select(graphic => graphic.Geometry as IPolygon).ToList(); routeParameters.SetPolygonBarriers(routeBarriers); // Set route options. routeParameters.FindBestSequence = findBestSequence.IsOn; routeParameters.PreserveFirstStop = preserveFirstStop.IsOn; routeParameters.PreserveLastStop = preserveLastStop.IsOn; ``` -------------------------------- ### Create and Update Exploratory Viewshed Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/MAUI/Maui.Samples/Samples/Analysis/ShowExploratoryViewshedFromCameraInScene/readme.md Create an ExploratoryLocationViewshed with an initial camera and distance, then update it from the camera's current position. This is useful for real-time visibility analysis in a scene. ```csharp ExploratoryLocationViewshed exploratoryViewshed = new ExploratoryLocationViewshed(camera, 100.0, 1000.0); // Update the viewshed to reflect the current camera position. await exploratoryViewshed.UpdateFromCamera(camera); // Add the viewshed to the analysis overlay. AnalysisOverlay analysisOverlay = new AnalysisOverlay(); analysisOverlay.AnalysisOverlays.Add(exploratoryViewshed); // Add the analysis overlay to the scene view. SceneView.AnalysisOverlays.Add(analysisOverlay); ``` -------------------------------- ### Get POI Suggestions Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/MAUI/Maui.Samples/Samples/Search/FindPlace/readme.md Use `LocatorTask.SuggestAsync` with `SuggestParameters` to get suggestions for places of interest. Add "POI" to the `categories` collection to filter suggestions to POIs. The `SuggestResult.label` is useful for displaying suggestions. ```csharp await locatorTask.SuggestAsync(placeQueryString, suggestParameters) ``` -------------------------------- ### Create LocatorTask Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Search/FindPlace/readme.md Initialize a LocatorTask with the URL of a locator service. ```csharp // 1. Create a LocatorTask using a URL to a locator service. var locatorTask = new LocatorTask("https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer"); ``` -------------------------------- ### Get Offline Data File Path Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/wiki/Offline-Data Use this pattern to get the path to an offline data file. It checks if the file exists and downloads it if necessary using the DataManager. Ensure the sample name is correctly substituted. ```csharp // Get the file path for the style dictionary private async Task GetStyleDictionaryPath() { #region offlinedata // The data manager provides a method to get the folder string folder = DataManager.GetDataFolder(); // Get the full path string filepath = Path.Combine(folder, "SampleData", "FeatureLayerDictionaryRenderer", "mil2525d.stylx"); // Check if the file exists if (!File.Exists(filepath)) { // Download the file await DataManager.GetData("e34835bf5ec5430da7cf16bb8c0b075c", "FeatureLayerDictionaryRenderer"); } return filepath; #endregion offlinedata } ``` -------------------------------- ### Create LocatorTask Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/WPF/WPF.Viewer/Samples/Search/FindPlace/readme.md Initialize a LocatorTask with the URL of a locator service. ```csharp var locatorTask = new LocatorTask("https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer"); ``` -------------------------------- ### Get POI suggestions Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Search/FindPlace/readme.md Retrieve suggestions for places of interest based on a partial query. ```csharp // 3. Get place of interest (POI) suggestions based on a place name query: // * Create SuggestParameters. var suggestParameters = new SuggestParameters { Categories = { "POI" } // Add "POI" to the parameters' categories collection. }; // * Call locatorTask.SuggestAsync(placeQueryString, suggestParameters) to get a list of SuggestResults. var suggestResults = await locatorTask.SuggestAsync(placeQueryString, suggestParameters); // * The SuggestResult will have a label to display in the search suggestions list. ``` -------------------------------- ### Get Default Route Parameters Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/WinUI/ArcGIS.WinUI.Viewer/Samples/NetworkAnalysis/RouteAroundBarriers/readme.md Obtain the default route parameters for the specified route service. ```csharp // Get default route parameters. var routeParameters = await _routeTask.CreateDefaultParametersAsync(); ``` -------------------------------- ### Configure Snap Settings from Rules Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/WPF/WPF.Viewer/Samples/UtilityNetwork/SnapGeometryEditsWithUtilityNetworkRules/readme.md Populate the SnapSettings.SourceSettings with SnapSourceSettings by enabling sources that have defined rules. This ensures snapping occurs only when valid connectivity rules exist. ```csharp snapSettings.SyncSourceSettings(snapRules, SnapSourceEnablingBehavior.SetFromRules); ``` -------------------------------- ### Load and display a mobile map package Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Map/OpenMobileMap/readme.md Instantiate a MobileMapPackage, load it asynchronously, and then set the MapView's map to the first map found in the package. ```csharp MobileMapPackage package = new MobileMapPackage("path/to/your/map.mmpk"); await package.LoadAsync(); if (package.LoadStatus == LoadStatus.Loaded && package.Maps.Count > 0) { mapView.Map = package.Maps.First(); } ``` -------------------------------- ### Get Default Route Parameters Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/WPF/WPF.Viewer/Samples/NetworkAnalysis/RouteAroundBarriers/readme.md Obtain the default route parameters for the specified route service. ```csharp _routeParameters = await _routeTask.CreateDefaultParametersAsync(); ``` -------------------------------- ### Load and display mobile map package Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/MAUI/Maui.Samples/Samples/Map/OpenMobileMap/readme.md Create a MobileMapPackage, load it asynchronously, and then set the MapView's map to the first map found in the package. ```csharp string mmpkPath = "path/to/your/Yellowstone.mmpk"; // Create a mobile map package. var package = new MobileMapPackage(mmpkPath); // Load the mobile map package. await package.LoadAsync(); // Check if the package loaded successfully and has maps. if (package.LoadStatus == LoadStatus.Loaded && package.Maps.Count > 0) { // Set the map view's map to the first map in the package. mapView.Map = package.Maps.First(); } ``` -------------------------------- ### Get Ranked Facilities Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/ClosestFacility/readme.md Access the list of facilities ranked by their proximity to the incident from the analysis results. ```csharp var rankedFacilitiesList = facilityResult.RankedFacilities[0]; ``` -------------------------------- ### Configure and Solve Route Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/WPF/WPF.Viewer/Samples/NetworkAnalysis/RouteAroundBarriers/readme.md Configure route parameters, including stops, barriers, and sequencing options, then solve the route. ```csharp // Configure route parameters. _routeParameters.ReturnStops = true; _routeParameters.ReturnDirections = true; // Set stops and barriers. _routeParameters.SetStops(_routeStops); _routeParameters.SetPolygonBarriers(_routeBarriers); // Set sequencing options. _routeParameters.FindBestSequence = findBestSequenceCheckBox.IsChecked; _routeParameters.PreserveFirstStop = preserveFirstStopCheckBox.IsChecked; _routeParameters.PreserveLastStop = preserveLastStopCheckBox.IsChecked; // Solve the route. var routeResult = await _routeTask.SolveRouteAsync(_routeParameters); // Get the first route. var firstResult = routeResult.Routes.First(); // Get the route geometry. var routeGeometry = firstResult.RouteGeometry; // Create a graphic for the route. var routeGraphic = new Graphic(routeGeometry, SimpleLineSymbol.Create(SimpleLineStyle.Solid, Colors.Blue, 5)); // Add the route graphic to the map. _routeOverlay.Graphics.Add(routeGraphic); // Display route steps. _directionsList.ItemsSource = firstResult.DirectionManeuvers; ``` -------------------------------- ### Get Default Route Parameters Source: https://github.com/esri/arcgis-maps-sdk-dotnet-samples/blob/main/src/MAUI/Maui.Samples/Samples/NetworkAnalysis/RouteAroundBarriers/readme.md Obtain the default route parameters for the specified route service. ```csharp var routeParameters = await _routeTask.CreateDefaultParametersAsync(); ```