diff --git a/src/Android/Xamarin.Android/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.cs b/src/Android/Xamarin.Android/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.cs index 79d40a25b6..633accaeff 100644 --- a/src/Android/Xamarin.Android/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.cs +++ b/src/Android/Xamarin.Android/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.cs @@ -28,12 +28,12 @@ namespace ArcGISRuntime.Samples.FeatureLayerQuery [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Feature layer query", "Data", - "This sample demonstrates how to query a feature layer via feature table.", + "Query a feature layer via a feature table.", "The sample provides a search bar on the top, where you can input the name of a US State. When you hit search the app performs a query on the feature table and based on the result either highlights the state geometry or provides an error.")] public class FeatureLayerQuery : Activity { // Create reference to service of US States - private string _statesUrl = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/2"; + private string _statesUrl = "https://services.arcgis.com/jIL9msH9OI208GCb/arcgis/rest/services/USA_Daytime_Population_2016/FeatureServer/0"; // Create and hold reference to the used MapView private MapView _myMapView = new MapView(); @@ -73,9 +73,10 @@ private void Initialize() // Create feature layer using this feature table _featureLayer = new FeatureLayer(_featureTable) { - // Set the Opacity of the Feature Layer - Opacity = 0.6 + Opacity = 0.6, + // Work around service setting + MaxScale = 10 }; // Create a new renderer for the States Feature Layer. diff --git a/src/Android/Xamarin.Android/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.cs b/src/Android/Xamarin.Android/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.cs index fb98d5b66c..26191a8241 100644 --- a/src/Android/Xamarin.Android/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.cs +++ b/src/Android/Xamarin.Android/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.cs @@ -25,12 +25,12 @@ namespace ArcGISRuntime.Samples.StatsQueryGroupAndSort [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Statistical query group and sort results", "Data", - "This sample demonstrates how to query a feature table to get statistics for a specified field and to group and sort the results.", + "Query a feature table to get grouped, sorted statistics.", "")] public class StatsQueryGroupAndSort : Activity { // URI for the US states map service - private Uri _usStatesServiceUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3"); + private Uri _usStatesServiceUri = new Uri("https://services.arcgis.com/jIL9msH9OI208GCb/arcgis/rest/services/Counties_Obesity_Inactivity_Diabetes_2013/FeatureServer/0"); // US states feature table private FeatureTable _usStatesTable; @@ -242,6 +242,9 @@ private async void ExecuteStatisticsQuery(object sender, EventArgs e) } } + // Ignore counties with missing data + statQueryParams.WhereClause = "\"State\" IS NOT NULL"; + // Execute the statistical query with these parameters and await the results StatisticsQueryResult statQueryResult = await _usStatesTable.QueryStatisticsAsync(statQueryParams); diff --git a/src/Android/Xamarin.Android/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.cs b/src/Android/Xamarin.Android/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.cs index 0ee0952df7..e25fa12f9e 100644 --- a/src/Android/Xamarin.Android/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.cs +++ b/src/Android/Xamarin.Android/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.cs @@ -16,6 +16,7 @@ using Esri.ArcGISRuntime.UI.Controls; using System; using System.Drawing; +using Esri.ArcGISRuntime; namespace ArcGISRuntime.Samples.FeatureLayerSelection { @@ -23,14 +24,14 @@ namespace ArcGISRuntime.Samples.FeatureLayerSelection [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Feature layer selection", "Layers", - "This sample demonstrates how to select features in a feature layer by tapping a MapView.", + "Select features by tapping a MapView.", "")] public class FeatureLayerSelection : Activity { - // Create and hold reference to the used MapView - private MapView _myMapView = new MapView(); + // Create and hold reference to the used MapView. + private readonly MapView _myMapView = new MapView(); - // Create and hold reference to the feature layer + // Hold reference to the feature layer. private FeatureLayer _featureLayer; protected override void OnCreate(Bundle bundle) @@ -39,107 +40,103 @@ protected override void OnCreate(Bundle bundle) Title = "Feature layer selection"; - // Create the UI, setup the control references and execute initialization CreateLayout(); Initialize(); } private async void Initialize() { - // Create new Map with basemap - Map myMap = new Map(Basemap.CreateTopographic()); + // Create new Map with basemap. + Map myMap = new Map(Basemap.CreateLightGrayCanvas()); - // Create envelope to be used as a target extent for map's initial viewpoint - Envelope myEnvelope = new Envelope(-128, 50, -62, 18, SpatialReferences.Wgs84); + // Create envelope to be used as a target extent for map's initial viewpoint. + Envelope myEnvelope = new Envelope(-6603299.491810, 1679677.742046, 9002253.947487, 8691318.054732, SpatialReferences.WebMercator); - // Set the initial viewpoint for map + // Set the initial viewpoint for map. myMap.InitialViewpoint = new Viewpoint(myEnvelope); - // Provide used Map to the MapView + // Provide used Map to the MapView. _myMapView.Map = myMap; - // Create Uri for the feature service + // Create Uri for the feature service. Uri featureServiceUri = new Uri( - "http://sampleserver6.arcgisonline.com/arcgis/rest/services/DamageAssessment/FeatureServer/0"); + "https://services1.arcgis.com/4yjifSiIG17X0gW4/arcgis/rest/services/GDP_per_capita_1960_2016/FeatureServer/0"); - // Initialize feature table using a url to feature server url + // Initialize feature table using a URL to feature server. ServiceFeatureTable featureTable = new ServiceFeatureTable(featureServiceUri); - // Initialize a new feature layer based on the feature table + // Initialize a new feature layer based on the feature table. _featureLayer = new FeatureLayer(featureTable) { - // Set the selection color for feature layer SelectionColor = Color.Cyan, - - // Set the selection width SelectionWidth = 3 }; - // Make sure that used feature layer is loaded before we hook into the tapped event - // This prevents us trying to do selection on the layer that isn't initialized + // Make sure that used feature layer is loaded before hooking into the tapped event + // This prevents trying to do selection on the layer that isn't initialized. await _featureLayer.LoadAsync(); - // Check for the load status. If the layer is loaded then add it to map - if (_featureLayer.LoadStatus == Esri.ArcGISRuntime.LoadStatus.Loaded) + // Check for the load status. If the layer is loaded then add it to map. + if (_featureLayer.LoadStatus == LoadStatus.Loaded) { - // Add the feature layer to the map + // Add the feature layer to the map. myMap.OperationalLayers.Add(_featureLayer); - // Add tap event handler for mapview + // Add tap event handler for mapview. _myMapView.GeoViewTapped += OnMapViewTapped; } } private async void OnMapViewTapped(object sender, GeoViewInputEventArgs e) { - // Define the selection tolerance + // Define the selection tolerance. double tolerance = 15; - // Convert the tolerance to map units + // Convert the tolerance to map units. double mapTolerance = tolerance * _myMapView.UnitsPerPixel; - // Get the tapped point + // Get the tapped point. MapPoint geometry = e.Location; - // Normalize the geometry if wrap-around is enabled - // This is necessary because of how wrapped-around map coordinates are handled by Runtime + // Normalize the geometry if wrap-around is enabled. + // This is necessary because of how wrapped-around map coordinates are handled by Runtime. // Without this step, querying may fail because wrapped-around coordinates are out of bounds. if (_myMapView.IsWrapAroundEnabled) { geometry = (MapPoint)GeometryEngine.NormalizeCentralMeridian(geometry); } - // Define the envelope around the tap location for selecting features + // Define the envelope around the tap location for selecting features. Envelope selectionEnvelope = new Envelope(geometry.X - mapTolerance, geometry.Y - mapTolerance, geometry.X + mapTolerance, geometry.Y + mapTolerance, _myMapView.Map.SpatialReference); - // Define the query parameters for selecting features + // Define the query parameters for selecting features. QueryParameters queryParams = new QueryParameters { - // Set the geometry to selection envelope for selection by geometry + // Set the geometry to selection envelope for selection by geometry. Geometry = selectionEnvelope }; - // Select the features based on query parameters defined above + // Select the features based on query parameters defined above. await _featureLayer.SelectFeaturesAsync(queryParams, SelectionMode.New); } private void CreateLayout() { - // Create a new vertical layout for the app + // Create a new vertical layout for the app. LinearLayout layout = new LinearLayout(this) { Orientation = Orientation.Vertical }; - // Create and add a help label + // Create and add a help label. TextView helpLabel = new TextView(this) { Text = "Tap to select features." }; layout.AddView(helpLabel); - // Add the map view to the layout + // Add the map view to the layout. layout.AddView(_myMapView); - // Show the layout in the app + // Show the layout in the app. SetContentView(layout); } } diff --git a/src/Android/Xamarin.Android/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg b/src/Android/Xamarin.Android/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg index afc6451f61..fcb422452c 100644 Binary files a/src/Android/Xamarin.Android/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg and b/src/Android/Xamarin.Android/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg differ diff --git a/src/Android/Xamarin.Android/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.cs b/src/Android/Xamarin.Android/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.cs index 095d64f5fa..3637b4f79a 100644 --- a/src/Android/Xamarin.Android/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.cs +++ b/src/Android/Xamarin.Android/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.cs @@ -10,9 +10,9 @@ using Android.App; using Android.OS; using Android.Widget; +using Esri.ArcGISRuntime.Geometry; using Esri.ArcGISRuntime.Mapping; using Esri.ArcGISRuntime.Rasters; -using Esri.ArcGISRuntime.ArcGISServices; using Esri.ArcGISRuntime.UI.Controls; using System; @@ -22,12 +22,12 @@ namespace ArcGISRuntime.Samples.RasterLayerImageServiceRaster [ArcGISRuntime.Samples.Shared.Attributes.Sample( "ArcGIS raster layer (service)", "Layers", - "This sample demonstrates how to show a raster layer on a map based on an image service layer.", + "Add a raster layer from an image service to a map.", "")] public class RasterLayerImageServiceRaster : Activity { - // Create and hold reference to the used MapView - private MapView _myMapView = new MapView(); + // Create and hold reference to the used MapView. + private readonly MapView _myMapView = new MapView(); protected override void OnCreate(Bundle bundle) { @@ -35,55 +35,46 @@ protected override void OnCreate(Bundle bundle) Title = "ArcGIS raster layer (service)"; - // Create the UI, setup the control references and execute initialization CreateLayout(); Initialize(); } private async void Initialize() { - // Create new map with the dark gray canvas basemap + // Create new map with the dark gray canvas basemap. Map myMap = new Map(Basemap.CreateDarkGrayCanvasVector()); - // Create a Uri to the image service raster - Uri myUri = new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/NLCDLandCover2001/ImageServer"); + // Create a Uri to the image service raster. + Uri myUri = new Uri("https://gis.ngdc.noaa.gov/arcgis/rest/services/bag_hillshades/ImageServer"); - // Create new image service raster from the Uri + // Create new image service raster from the Uri. ImageServiceRaster myImageServiceRaster = new ImageServiceRaster(myUri); - // Load the image service raster + // Load the image service raster. await myImageServiceRaster.LoadAsync(); - // Get the service information (aka. metadata) about the image service raster - ArcGISImageServiceInfo myArcGISImageServiceInfo = myImageServiceRaster.ServiceInfo; - - // Create a new raster layer from the image service raster + // Create a new raster layer from the image service raster. RasterLayer myRasterLayer = new RasterLayer(myImageServiceRaster); - // Add the raster layer to the maps layer collection + // Add the raster layer to the maps layer collection. myMap.Basemap.BaseLayers.Add(myRasterLayer); - // Assign the map to the map view + // Assign the map to the map view. _myMapView.Map = myMap; - // Zoom the map to the extent of the image service raster (which also the extent of the raster layer) - await _myMapView.SetViewpointGeometryAsync(myArcGISImageServiceInfo.FullExtent); - - // NOTE: The sample zooms to the extent of the ImageServiceRaster. Currently the ArcGIS Runtime does not - // support zooming a RasterLayer out beyond 4 times it's published level of detail. The sample uses - // MapView.SetViewpointCenterAsync() method to ensure the image shows when the app starts. You can see - // the effect of the image service not showing when you zoom out to the full extent of the image and beyond. } + // zoom in to the San Francisco Bay. + await _myMapView.SetViewpointCenterAsync(new MapPoint(-13643095.660131, 4550009.846004, SpatialReferences.WebMercator), 100000); } private void CreateLayout() { - // Create a new vertical layout for the app + // Create a new vertical layout for the app. LinearLayout layout = new LinearLayout(this) { Orientation = Orientation.Vertical }; - // Add the map view to the layout + // Add the map view to the layout. layout.AddView(_myMapView); - // Show the layout in the app + // Show the layout in the app. SetContentView(layout); } } diff --git a/src/Android/Xamarin.Android/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg b/src/Android/Xamarin.Android/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg index 4cb1c59bed..2eed3e2408 100644 Binary files a/src/Android/Xamarin.Android/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg and b/src/Android/Xamarin.Android/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg differ diff --git a/src/Android/Xamarin.Android/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.cs b/src/Android/Xamarin.Android/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.cs index 982ebee929..76d6dd52a1 100644 --- a/src/Android/Xamarin.Android/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.cs +++ b/src/Android/Xamarin.Android/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.cs @@ -11,6 +11,7 @@ using Android.OS; using Android.Widget; using Esri.ArcGISRuntime.Data; +using Esri.ArcGISRuntime.Geometry; using Esri.ArcGISRuntime.Mapping; using Esri.ArcGISRuntime.UI.Controls; @@ -20,7 +21,7 @@ namespace ArcGISRuntime.Samples.ShowLabelsOnLayer [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Show labels on layer", "Layers", - "This sample demonstrates how to show labels on a feature layer", + "Show labels on a feature layer using a JSON label definition.", "The labeling of the names on the US Highways layer is accomplished by supplying a JSON string to the FeatureLayer's LabelDefinition. The JSON is based on the new ArcGIS web map specification.", "")] public class ShowLabelsOnLayer : Activity @@ -47,38 +48,62 @@ private async void Initialize() // Assign the map to the MapView. _myMapView.Map = sampleMap; - // Define the Url string for the US highways feature layer. - string highwaysUrlString = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/1"; + // Define the URL string for the feature layer. + string layerUrl = "https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Congressional_Districts_analysis/FeatureServer/0"; - // Create a service feature table from the url to the US highways feature service. - ServiceFeatureTable highwaysServiceFeatureTable = new ServiceFeatureTable(new System.Uri(highwaysUrlString)); + // Create a service feature table from the URL. + ServiceFeatureTable featureTable = new ServiceFeatureTable(new System.Uri(layerUrl)); // Create a feature layer from the service feature table. - FeatureLayer highwaysFeatureLayer = new FeatureLayer(highwaysServiceFeatureTable); + FeatureLayer districtFeatureLabel = new FeatureLayer(featureTable); - // Add the US highways feature layer to the operations layers collection of the map. - sampleMap.OperationalLayers.Add(highwaysFeatureLayer); + // Add the feature layer to the operations layers collection of the map. + sampleMap.OperationalLayers.Add(districtFeatureLabel); - // Load the US highways feature layer - this way we can obtain it's extent. - await highwaysFeatureLayer.LoadAsync(); + // Load the feature layer - this way we can obtain it's extent. + await districtFeatureLabel.LoadAsync(); - // Zoom the map view to the extent of the US highways feature layer. - await _myMapView.SetViewpointGeometryAsync(highwaysFeatureLayer.FullExtent); + // Zoom the map view to the extent of the feature layer. + await _myMapView.SetViewpointCenterAsync(new MapPoint(-10846309.950860, 4683272.219411, SpatialReferences.WebMercator), 20000000); // Help regarding the Json syntax for defining the LabelDefinition.FromJson syntax can be found here: // https://developers.arcgis.com/web-map-specification/objects/labelingInfo/ // This particular JSON string will have the following characteristics: - // (1) The 'labelExpressionInfo' defines that the label text displayed comes from the field 'rte_num1' in the - // feature service and will be prefaced with an "I -". Example: "I - 10", "I - 15", "I - 95", etc. - // (2) The 'labelPlacement' will be placed above and along the highway polyline segment. - // (3) The 'where' clause restricts the labels to be displayed that has valid (non-empty) data. Empty data - // for this service has a single blank space in the 'rte_num1' field. - // (4) The 'symbol' for the labeled text will be blue with a yellow halo. - string theJSON_String = + string redLabelJson = @"{ - ""labelExpressionInfo"":{""expression"":""'I - ' + $feature.rte_num1""}, - ""labelPlacement"":""esriServerLinePlacementAboveAlong"", - ""where"":""rte_num1 <> ' '"", + ""labelExpressionInfo"":{""expression"":""$feature.NAME + ' (' + left($feature.PARTY,1) + ')\\nDistrict' + $feature.CDFIPS""}, + ""labelPlacement"":""esriServerPolygonPlacementAlwaysHorizontal"", + ""where"":""PARTY = 'Republican'"", + ""symbol"": + { + ""angle"":0, + ""backgroundColor"":[0,0,0,0], + ""borderLineColor"":[0,0,0,0], + ""borderLineSize"":0, + ""color"":[255,0,0,255], + ""font"": + { + ""decoration"":""none"", + ""size"":10, + ""style"":""normal"", + ""weight"":""normal"" + }, + ""haloColor"":[255,255,255,255], + ""haloSize"":2, + ""horizontalAlignment"":""center"", + ""kerning"":false, + ""type"":""esriTS"", + ""verticalAlignment"":""middle"", + ""xoffset"":0, + ""yoffset"":0 + } + }"; + + string blueLabelJson = + @"{ + ""labelExpressionInfo"":{""expression"":""$feature.NAME + ' (' + left($feature.PARTY,1) + ')\\nDistrict' + $feature.CDFIPS""}, + ""labelPlacement"":""esriServerPolygonPlacementAlwaysHorizontal"", + ""where"":""PARTY = 'Democrat'"", ""symbol"": { ""angle"":0, @@ -89,12 +114,12 @@ private async void Initialize() ""font"": { ""decoration"":""none"", - ""size"":15, + ""size"":10, ""style"":""normal"", ""weight"":""normal"" }, - ""haloColor"":[255,255,0,255], - ""haloSize"":1.5, + ""haloColor"":[255,255,255,255], + ""haloSize"":2, ""horizontalAlignment"":""center"", ""kerning"":false, ""type"":""esriTS"", @@ -105,13 +130,15 @@ private async void Initialize() }"; // Create a label definition from the JSON string. - LabelDefinition highwaysLabelDefinition = LabelDefinition.FromJson(theJSON_String); + LabelDefinition redLabelDefinition = LabelDefinition.FromJson(redLabelJson); + LabelDefinition blueLabelDefinition = LabelDefinition.FromJson(blueLabelJson); // Add the label definition to the feature layer's label definition collection. - highwaysFeatureLayer.LabelDefinitions.Add(highwaysLabelDefinition); + districtFeatureLabel.LabelDefinitions.Add(redLabelDefinition); + districtFeatureLabel.LabelDefinitions.Add(blueLabelDefinition); // Enable the visibility of labels to be seen. - highwaysFeatureLayer.LabelsEnabled = true; + districtFeatureLabel.LabelsEnabled = true; } private void CreateLayout() diff --git a/src/Android/Xamarin.Android/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg b/src/Android/Xamarin.Android/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg index 394e2561a3..6acadb84e4 100644 Binary files a/src/Android/Xamarin.Android/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg and b/src/Android/Xamarin.Android/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg differ diff --git a/src/Android/Xamarin.Android/Samples/Layers/WMSLayerUrl/WMSLayerUrl.cs b/src/Android/Xamarin.Android/Samples/Layers/WMSLayerUrl/WMSLayerUrl.cs index 816934cf84..983d02982e 100644 --- a/src/Android/Xamarin.Android/Samples/Layers/WMSLayerUrl/WMSLayerUrl.cs +++ b/src/Android/Xamarin.Android/Samples/Layers/WMSLayerUrl/WMSLayerUrl.cs @@ -22,18 +22,19 @@ namespace ArcGISRuntime.Samples.WMSLayerUrl [ArcGISRuntime.Samples.Shared.Attributes.Sample( "WMS layer (URL)", "Layers", - "This sample demonstrates how to add a layer from a WMS service to a map.", + "Add a layer from a WMS service to a map.", "")] public class WMSLayerUrl : Activity { // Create and hold reference to the used MapView private MapView _myMapView = new MapView(); - // Hold the URL to the WMS service showing the geology of Africa - private Uri wmsUrl = new Uri("https://certmapper.cr.usgs.gov/arcgis/services/geology/africa/MapServer/WMSServer?request=GetCapabilities&service=WMS"); + // Hold the URL to the WMS service showing U.S. weather radar. + private readonly Uri _wmsUrl = new Uri( + "https://nowcoast.noaa.gov/arcgis/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer/WMSServer?request=GetCapabilities&service=WMS"); - // Hold a list of uniquely-identifying WMS layer names to display - private List wmsLayerNames = new List { "0" }; + // Hold a list of uniquely-identifying WMS layer names to display. + private readonly List _wmsLayerNames = new List { "1" }; protected override void OnCreate(Bundle bundle) { @@ -41,42 +42,39 @@ protected override void OnCreate(Bundle bundle) Title = "WMS layer (URL)"; - // Create the UI, setup the control references CreateLayout(); - - // Initialize the map Initialize(); } private void CreateLayout() { - // Create a new vertical layout for the app + // Create a new vertical layout for the app. LinearLayout layout = new LinearLayout(this) { Orientation = Orientation.Vertical }; - // Add the map view to the layout + // Add the map view to the layout. layout.AddView(_myMapView); - // Show the layout in the app + // Show the layout in the app. SetContentView(layout); } private void Initialize() { - // Apply an imagery basemap to the map - Map myMap = new Map(Basemap.CreateImagery()) + // Create a map with basemap and initial viewpoint. + Map myMap = new Map(Basemap.CreateLightGrayCanvas()) { - - // Set the initial viewpoint - InitialViewpoint = new Viewpoint(new MapPoint(25.450, -4.59, SpatialReferences.Wgs84), 1000000) + // Set the initial viewpoint. + InitialViewpoint = new Viewpoint( + new Envelope(-19195297.778679, 512343.939994, -3620418.579987, 8658913.035426, 0.0, 0.0, SpatialReferences.WebMercator)) }; - // Add the map to the mapview + // Add the map to the mapview. _myMapView.Map = myMap; - // Create a new WMS layer displaying the specified layers from the service - WmsLayer myWmsLayer = new WmsLayer(wmsUrl, wmsLayerNames); + // Create a new WMS layer displaying the specified layers from the service. + WmsLayer myWmsLayer = new WmsLayer(_wmsUrl, _wmsLayerNames); - // Add the layer to the map + // Add the layer to the map. myMap.OperationalLayers.Add(myWmsLayer); } } diff --git a/src/Android/Xamarin.Android/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg b/src/Android/Xamarin.Android/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg index 7be3279ebd..6c393ecf74 100644 Binary files a/src/Android/Xamarin.Android/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg and b/src/Android/Xamarin.Android/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg differ diff --git a/src/Android/Xamarin.Android/Samples/Map/OpenScene/OpenScene.cs b/src/Android/Xamarin.Android/Samples/Map/OpenScene/OpenScene.cs index d9dbfd9c0c..275dafe991 100644 --- a/src/Android/Xamarin.Android/Samples/Map/OpenScene/OpenScene.cs +++ b/src/Android/Xamarin.Android/Samples/Map/OpenScene/OpenScene.cs @@ -21,12 +21,12 @@ namespace ArcGISRuntime.Samples.OpenScene [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Open scene (Portal item)", "Map", - "This sample demonstrates how to open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal.", + "Open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal.", "The sample will load the scene automatically.")] public class OpenScene : Activity { // Hold the ID of the portal item, which is a web scene. - private const string ItemId = "a13c3c3540144967bc933cb5e498b8e4"; + private const string ItemId = "c6f90b19164c4283884361005faea852"; // Create the scene view. private readonly SceneView _mySceneView = new SceneView(); @@ -37,7 +37,6 @@ protected override void OnCreate(Bundle bundle) Title = "Open scene (Portal item)"; - // Create the UI, setup the control references and execute initialization CreateLayout(); Initialize(); } diff --git a/src/Android/Xamarin.Android/Samples/Map/OpenScene/OpenScene.jpg b/src/Android/Xamarin.Android/Samples/Map/OpenScene/OpenScene.jpg index 6e7e8c79b7..6461b071b0 100644 Binary files a/src/Android/Xamarin.Android/Samples/Map/OpenScene/OpenScene.jpg and b/src/Android/Xamarin.Android/Samples/Map/OpenScene/OpenScene.jpg differ diff --git a/src/Android/Xamarin.Android/Samples/Map/OpenScene/readme.md b/src/Android/Xamarin.Android/Samples/Map/OpenScene/readme.md index c89b9cd1c1..e6ecbf2241 100644 --- a/src/Android/Xamarin.Android/Samples/Map/OpenScene/readme.md +++ b/src/Android/Xamarin.Android/Samples/Map/OpenScene/readme.md @@ -1,9 +1,21 @@ -# Open scene (Portal item) +# Open a scene (Portal item) -This sample demonstrates how to open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal. +This sample demonstrates how to open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal. - +![](OpenScene.jpg) -## Instructions +## How to use the sample -The sample will load the scene automatically. +When the sample loads, a scene from ArcGIS Online will be displayed. + +## How it works + +This sample uses the scene portal item constructor to open a scene from ArcGIS Online. + +## Relevant API + +* `Scene.LoadAsync` + +## Tags + +Scenes, Web Scene, Portal \ No newline at end of file diff --git a/src/Forms/Shared/SamplePage.xaml.cs b/src/Forms/Shared/SamplePage.xaml.cs index f16daed533..8e2af65033 100644 --- a/src/Forms/Shared/SamplePage.xaml.cs +++ b/src/Forms/Shared/SamplePage.xaml.cs @@ -74,7 +74,7 @@ public SamplePage(ContentPage sample, SampleInfo sampleInfo) : this() readmeContent = _markdownRenderer.Parse(readmeContent); // Fix paths for images. - readmeContent = readmeContent.Replace("src=\"", $"src=\"{basePath}/"); + readmeContent = readmeContent.Replace("src='", "src=\"").Replace(".jpg'", ".jpg\"").Replace("src=\"", $"src=\"{basePath}/"); string htmlString = $"{readmeContent}"; DescriptionView.Source = new HtmlWebViewSource() diff --git a/src/Forms/Shared/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.xaml.cs b/src/Forms/Shared/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.xaml.cs index c266f3e942..cde67231e4 100644 --- a/src/Forms/Shared/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.xaml.cs +++ b/src/Forms/Shared/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.xaml.cs @@ -23,7 +23,7 @@ namespace ArcGISRuntime.Samples.FeatureLayerQuery [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Feature layer query", "Data", - "This sample demonstrates how to query a feature layer via feature table.", + "Query a feature layer via a feature table.", "The sample provides a search bar on the top, where you can input the name of a US State. When you hit search the app performs a query on the feature table and based on the result either highlights the state geometry or provides an error.")] public partial class FeatureLayerQuery : ContentPage { @@ -61,9 +61,10 @@ private void Initialize() // Create feature layer using this feature table _featureLayer = new FeatureLayer(_featureTable) { - // Set the Opacity of the Feature Layer - Opacity = 0.6 + Opacity = 0.6, + // Work around service setting + MaxScale = 10 }; // Create a new renderer for the States Feature Layer. diff --git a/src/Forms/Shared/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml.cs b/src/Forms/Shared/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml.cs index 8d53aee8db..42596458c5 100644 --- a/src/Forms/Shared/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml.cs +++ b/src/Forms/Shared/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml.cs @@ -19,12 +19,12 @@ namespace ArcGISRuntime.Samples.StatsQueryGroupAndSort [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Statistical query group and sort results", "Data", - "This sample demonstrates how to query a feature table to get statistics for a specified field and to group and sort the results.", + "Query a feature table to get grouped, sorted statistics.", "")] public partial class StatsQueryGroupAndSort : ContentPage { // URI for the US states map service - private Uri _usStatesServiceUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3"); + private Uri _usStatesServiceUri = new Uri("https://services.arcgis.com/jIL9msH9OI208GCb/arcgis/rest/services/Counties_Obesity_Inactivity_Diabetes_2013/FeatureServer/0"); // US states feature table private FeatureTable _usStatesTable; @@ -96,6 +96,9 @@ private async void OnExecuteStatisticsQueryClicked(object sender, EventArgs e) statQueryParams.OrderByFields.Add(orderBy.OrderInfo); } + // Ignore counties with missing data + statQueryParams.WhereClause = "\"State\" IS NOT NULL"; + // Execute the statistical query with these parameters and await the results StatisticsQueryResult statQueryResult = await _usStatesTable.QueryStatisticsAsync(statQueryParams); diff --git a/src/Forms/Shared/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg b/src/Forms/Shared/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg index afc6451f61..9517f5d62c 100644 Binary files a/src/Forms/Shared/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg and b/src/Forms/Shared/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg differ diff --git a/src/Forms/Shared/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.xaml.cs b/src/Forms/Shared/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.xaml.cs index d4aff094e5..045237168d 100644 --- a/src/Forms/Shared/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.xaml.cs +++ b/src/Forms/Shared/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.xaml.cs @@ -21,11 +21,11 @@ namespace ArcGISRuntime.Samples.FeatureLayerSelection [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Feature layer selection", "Layers", - "This sample demonstrates how to select features in a feature layer by tapping a MapView.", + "Select features by tapping a MapView.", "")] public partial class FeatureLayerSelection : ContentPage { - //Create and hold reference to the feature layer + // Hold reference to the feature layer. private FeatureLayer _featureLayer; public FeatureLayerSelection() @@ -33,89 +33,85 @@ public FeatureLayerSelection() InitializeComponent (); Title = "Feature layer selection"; - // Create the UI, setup the control references and execute initialization Initialize(); } private async void Initialize() { - // Create new Map with basemap - Map myMap = new Map(Basemap.CreateTopographic()); + // Create new Map with basemap. + Map myMap = new Map(Basemap.CreateLightGrayCanvas()); - // Create envelope to be used as a target extent for map's initial viewpoint - Envelope myEnvelope = new Envelope( - -1131596.019761, 3893114.069099, 3926705.982140, 7977912.461790, - SpatialReferences.WebMercator); + // Create envelope to be used as a target extent for map's initial viewpoint. + Envelope myEnvelope = new Envelope(-6603299.491810, 1679677.742046, 9002253.947487, 8691318.054732, SpatialReferences.WebMercator); - // Set the initial viewpoint for map + // Set the initial viewpoint for map. myMap.InitialViewpoint = new Viewpoint(myEnvelope); - // Provide used Map to the MapView + // Provide used Map to the MapView. MyMapView.Map = myMap; - // Create Uri for the feature service + // Create Uri for the feature service. Uri featureServiceUri = new Uri( - "https://sampleserver6.arcgisonline.com/arcgis/rest/services/DamageAssessment/FeatureServer/0"); + "https://services1.arcgis.com/4yjifSiIG17X0gW4/arcgis/rest/services/GDP_per_capita_1960_2016/FeatureServer/0"); - // Initialize feature table using a url to feature server url + // Initialize feature table using a URL to feature server. ServiceFeatureTable featureTable = new ServiceFeatureTable(featureServiceUri); - // Initialize a new feature layer based on the feature table + // Initialize a new feature layer based on the feature table. _featureLayer = new FeatureLayer(featureTable) { - - // Set the selection color for feature layer - SelectionColor = Colors.Cyan, - - // Set the selection width + SelectionColor = Color.Cyan, SelectionWidth = 3 }; - // Make sure that used feature layer is loaded before we hook into the tapped event - // This prevents us trying to do selection on the layer that isn't initialized + // Make sure that used feature layer is loaded before hooking into the tapped event + // This prevents trying to do selection on the layer that isn't initialized. await _featureLayer.LoadAsync(); - // Check for the load status. If the layer is loaded then add it to map + // Check for the load status. If the layer is loaded then add it to map. if (_featureLayer.LoadStatus == LoadStatus.Loaded) { - // Add the feature layer to the map + // Add the feature layer to the map. myMap.OperationalLayers.Add(_featureLayer); - // Add tap event handler for mapview + // Add tap event handler for mapview. MyMapView.GeoViewTapped += OnMapViewTapped; - } + } } private async void OnMapViewTapped(object sender, GeoViewInputEventArgs e) { try { - // Define the selection tolerance + // Define the selection tolerance. double tolerance = 15; - // Convert the tolerance to map units + // Convert the tolerance to map units. double mapTolerance = tolerance * MyMapView.UnitsPerPixel; - // Get the tapped point + // Get the tapped point. MapPoint geometry = e.Location; - // Normalize the geometry if wrap-around is enabled - // This is necessary because of how wrapped-around map coordinates are handled by Runtime + // Normalize the geometry if wrap-around is enabled. + // This is necessary because of how wrapped-around map coordinates are handled by Runtime. // Without this step, querying may fail because wrapped-around coordinates are out of bounds. - if (MyMapView.IsWrapAroundEnabled) { geometry = (MapPoint)GeometryEngine.NormalizeCentralMeridian(geometry); } + if (MyMapView.IsWrapAroundEnabled) + { + geometry = (MapPoint)GeometryEngine.NormalizeCentralMeridian(geometry); + } - // Define the envelope around the tap location for selecting features + // Define the envelope around the tap location for selecting features. Envelope selectionEnvelope = new Envelope(geometry.X - mapTolerance, geometry.Y - mapTolerance, geometry.X + mapTolerance, geometry.Y + mapTolerance, MyMapView.Map.SpatialReference); - // Define the query parameters for selecting features + // Define the query parameters for selecting features. QueryParameters queryParams = new QueryParameters { - // Set the geometry to selection envelope for selection by geometry + // Set the geometry to selection envelope for selection by geometry. Geometry = selectionEnvelope }; - // Select the features based on query parameters defined above + // Select the features based on query parameters defined above. await _featureLayer.SelectFeaturesAsync(queryParams, SelectionMode.New); } catch (Exception ex) diff --git a/src/Forms/Shared/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg b/src/Forms/Shared/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg index 4cb1c59bed..8fdc90c5a5 100644 Binary files a/src/Forms/Shared/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg and b/src/Forms/Shared/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg differ diff --git a/src/Forms/Shared/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.xaml.cs b/src/Forms/Shared/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.xaml.cs index 23382c0939..f1d95d9e68 100644 --- a/src/Forms/Shared/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.xaml.cs +++ b/src/Forms/Shared/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.xaml.cs @@ -7,9 +7,9 @@ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific // language governing permissions and limitations under the License. +using Esri.ArcGISRuntime.Geometry; using Esri.ArcGISRuntime.Mapping; using Esri.ArcGISRuntime.Rasters; -using Esri.ArcGISRuntime.ArcGISServices; using System; using Xamarin.Forms; @@ -18,7 +18,7 @@ namespace ArcGISRuntime.Samples.RasterLayerImageServiceRaster [ArcGISRuntime.Samples.Shared.Attributes.Sample( "ArcGIS raster layer (service)", "Layers", - "This sample demonstrates how to show a raster layer on a map based on an image service layer.", + "Add a raster layer from an image service to a map.", "")] public partial class RasterLayerImageServiceRaster : ContentPage { @@ -27,44 +27,34 @@ public RasterLayerImageServiceRaster() InitializeComponent (); Title = "ArcGIS raster layer (service)"; - - // Create the UI, setup the control references and execute initialization Initialize(); } private async void Initialize() { - // Create new map with the dark gray canvas basemap + // Create new map with the dark gray canvas basemap. Map myMap = new Map(Basemap.CreateDarkGrayCanvasVector()); - // Create a Uri to the image service raster (NOTE: iOS applications require the use of Uri's to be https:// and not http://) - Uri myUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/NLCDLandCover2001/ImageServer"); + // Create a Uri to the image service raster. (NOTE: iOS applications require the use of Uri's to be https:// and not http://) + Uri myUri = new Uri("https://gis.ngdc.noaa.gov/arcgis/rest/services/bag_hillshades/ImageServer"); - // Create new image service raster from the Uri + // Create new image service raster from the Uri. ImageServiceRaster myImageServiceRaster = new ImageServiceRaster(myUri); - // Load the image service raster + // Load the image service raster. await myImageServiceRaster.LoadAsync(); - // Get the service information (aka. metadata) about the image service raster - ArcGISImageServiceInfo myArcGISImageServiceInfo = myImageServiceRaster.ServiceInfo; - - // Create a new raster layer from the image service raster + // Create a new raster layer from the image service raster. RasterLayer myRasterLayer = new RasterLayer(myImageServiceRaster); - // Add the raster layer to the maps layer collection + // Add the raster layer to the maps layer collection. myMap.Basemap.BaseLayers.Add(myRasterLayer); - // Assign the map to the map view + // Assign the map to the map view. MyMapView.Map = myMap; - // Zoom the map to the extent of the image service raster (which also the extent of the raster layer) - await MyMapView.SetViewpointGeometryAsync(myArcGISImageServiceInfo.FullExtent); - - // NOTE: The sample zooms to the extent of the ImageServiceRaster. Currently the ArcGIS Runtime does not - // support zooming a RasterLayer out beyond 4 times it's published level of detail. The sample uses - // MapView.SetViewpointCenterAsync() method to ensure the image shows when the app starts. You can see - // the effect of the image service not showing when you zoom out to the full extent of the image and beyond. } + // zoom in to the San Francisco Bay. + await MyMapView.SetViewpointCenterAsync(new MapPoint(-13643095.660131, 4550009.846004, SpatialReferences.WebMercator), 100000); } } } diff --git a/src/Forms/Shared/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg b/src/Forms/Shared/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg index 2d0d594c04..3ed0149989 100644 Binary files a/src/Forms/Shared/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg and b/src/Forms/Shared/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg differ diff --git a/src/Forms/Shared/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.xaml.cs b/src/Forms/Shared/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.xaml.cs index d947b0a02b..4a8e42c1b0 100644 --- a/src/Forms/Shared/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.xaml.cs +++ b/src/Forms/Shared/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.xaml.cs @@ -8,6 +8,7 @@ // language governing permissions and limitations under the License. using Esri.ArcGISRuntime.Data; +using Esri.ArcGISRuntime.Geometry; using Esri.ArcGISRuntime.Mapping; using Xamarin.Forms; @@ -16,7 +17,7 @@ namespace ArcGISRuntime.Samples.ShowLabelsOnLayer [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Show labels on layer", "Layers", - "This sample demonstrates how to show labels on a feature layer", + "Show labels on a feature layer using a JSON label definition.", "The labeling of the names on the US Highways layer is accomplished by supplying a JSON string to the FeatureLayer's LabelDefinition. The JSON is based on the new ArcGIS web map specification.", "")] public partial class ShowLabelsOnLayer : ContentPage @@ -39,38 +40,62 @@ private async void Initialize() // Assign the map to the MapView. MyMapView.Map = sampleMap; - // Define the Url string for the US highways feature layer. - string highwaysUrlString = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/1"; + // Define the URL string for the feature layer. + string layerUrl = "https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Congressional_Districts_analysis/FeatureServer/0"; - // Create a service feature table from the url to the US highways feature service. - ServiceFeatureTable highwaysServiceFeatureTable = new ServiceFeatureTable(new System.Uri(highwaysUrlString)); + // Create a service feature table from the URL. + ServiceFeatureTable featureTable = new ServiceFeatureTable(new System.Uri(layerUrl)); // Create a feature layer from the service feature table. - FeatureLayer highwaysFeatureLayer = new FeatureLayer(highwaysServiceFeatureTable); + FeatureLayer districtFeatureLabel = new FeatureLayer(featureTable); - // Add the US highways feature layer to the operations layers collection of the map. - sampleMap.OperationalLayers.Add(highwaysFeatureLayer); + // Add the feature layer to the operations layers collection of the map. + sampleMap.OperationalLayers.Add(districtFeatureLabel); - // Load the US highways feature layer - this way we can obtain it's extent. - await highwaysFeatureLayer.LoadAsync(); + // Load the feature layer - this way we can obtain it's extent. + await districtFeatureLabel.LoadAsync(); - // Zoom the map view to the extent of the US highways feature layer. - await MyMapView.SetViewpointGeometryAsync(highwaysFeatureLayer.FullExtent); + // Zoom the map view to the extent of the feature layer. + await MyMapView.SetViewpointCenterAsync(new MapPoint(-10846309.950860, 4683272.219411, SpatialReferences.WebMercator), 20000000); // Help regarding the Json syntax for defining the LabelDefinition.FromJson syntax can be found here: // https://developers.arcgis.com/web-map-specification/objects/labelingInfo/ // This particular JSON string will have the following characteristics: - // (1) The 'labelExpressionInfo' defines that the label text displayed comes from the field 'rte_num1' in the - // feature service and will be prefaced with an "I -". Example: "I - 10", "I - 15", "I - 95", etc. - // (2) The 'labelPlacement' will be placed above and along the highway polyline segment. - // (3) The 'where' clause restricts the labels to be displayed that has valid (non-empty) data. Empty data - // for this service has a single blank space in the 'rte_num1' field. - // (4) The 'symbol' for the labeled text will be blue with a yellow halo. - string theJSON_String = + string redLabelJson = @"{ - ""labelExpressionInfo"":{""expression"":""'I - ' + $feature.rte_num1""}, - ""labelPlacement"":""esriServerLinePlacementAboveAlong"", - ""where"":""rte_num1 <> ' '"", + ""labelExpressionInfo"":{""expression"":""$feature.NAME + ' (' + left($feature.PARTY,1) + ')\\nDistrict' + $feature.CDFIPS""}, + ""labelPlacement"":""esriServerPolygonPlacementAlwaysHorizontal"", + ""where"":""PARTY = 'Republican'"", + ""symbol"": + { + ""angle"":0, + ""backgroundColor"":[0,0,0,0], + ""borderLineColor"":[0,0,0,0], + ""borderLineSize"":0, + ""color"":[255,0,0,255], + ""font"": + { + ""decoration"":""none"", + ""size"":10, + ""style"":""normal"", + ""weight"":""normal"" + }, + ""haloColor"":[255,255,255,255], + ""haloSize"":2, + ""horizontalAlignment"":""center"", + ""kerning"":false, + ""type"":""esriTS"", + ""verticalAlignment"":""middle"", + ""xoffset"":0, + ""yoffset"":0 + } + }"; + + string blueLabelJson = + @"{ + ""labelExpressionInfo"":{""expression"":""$feature.NAME + ' (' + left($feature.PARTY,1) + ')\\nDistrict' + $feature.CDFIPS""}, + ""labelPlacement"":""esriServerPolygonPlacementAlwaysHorizontal"", + ""where"":""PARTY = 'Democrat'"", ""symbol"": { ""angle"":0, @@ -81,12 +106,12 @@ private async void Initialize() ""font"": { ""decoration"":""none"", - ""size"":15, + ""size"":10, ""style"":""normal"", ""weight"":""normal"" }, - ""haloColor"":[255,255,0,255], - ""haloSize"":1.5, + ""haloColor"":[255,255,255,255], + ""haloSize"":2, ""horizontalAlignment"":""center"", ""kerning"":false, ""type"":""esriTS"", @@ -97,13 +122,15 @@ private async void Initialize() }"; // Create a label definition from the JSON string. - LabelDefinition highwaysLabelDefinition = LabelDefinition.FromJson(theJSON_String); + LabelDefinition redLabelDefinition = LabelDefinition.FromJson(redLabelJson); + LabelDefinition blueLabelDefinition = LabelDefinition.FromJson(blueLabelJson); // Add the label definition to the feature layer's label definition collection. - highwaysFeatureLayer.LabelDefinitions.Add(highwaysLabelDefinition); + districtFeatureLabel.LabelDefinitions.Add(redLabelDefinition); + districtFeatureLabel.LabelDefinitions.Add(blueLabelDefinition); // Enable the visibility of labels to be seen. - highwaysFeatureLayer.LabelsEnabled = true; + districtFeatureLabel.LabelsEnabled = true; } } diff --git a/src/Forms/Shared/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg b/src/Forms/Shared/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg index 3f5171d2ff..9a71cdf395 100644 Binary files a/src/Forms/Shared/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg and b/src/Forms/Shared/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg differ diff --git a/src/Forms/Shared/Samples/Layers/WMSLayerUrl/WMSLayerUrl.xaml.cs b/src/Forms/Shared/Samples/Layers/WMSLayerUrl/WMSLayerUrl.xaml.cs index 31e87b71c8..26f337d371 100644 --- a/src/Forms/Shared/Samples/Layers/WMSLayerUrl/WMSLayerUrl.xaml.cs +++ b/src/Forms/Shared/Samples/Layers/WMSLayerUrl/WMSLayerUrl.xaml.cs @@ -18,15 +18,16 @@ namespace ArcGISRuntime.Samples.WMSLayerUrl [ArcGISRuntime.Samples.Shared.Attributes.Sample( "WMS layer (URL)", "Layers", - "This sample demonstrates how to add a layer from a WMS service to a map.", + "Add a layer from a WMS service to a map.", "")] public partial class WMSLayerUrl : ContentPage { - // Hold the URL to the WMS service showing the geology of Africa - private Uri wmsUrl = new Uri("https://certmapper.cr.usgs.gov/arcgis/services/geology/africa/MapServer/WMSServer?request=GetCapabilities&service=WMS"); + // Hold the URL to the WMS service showing U.S. weather radar. + private readonly Uri _wmsUrl = new Uri( + "https://nowcoast.noaa.gov/arcgis/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer/WMSServer?request=GetCapabilities&service=WMS"); - // Hold a list of uniquely-identifying WMS layer names to display - private List wmsLayerNames = new List { "0" }; + // Hold a list of uniquely-identifying WMS layer names to display. + private readonly List _wmsLayerNames = new List { "1" }; public WMSLayerUrl() { @@ -34,27 +35,26 @@ public WMSLayerUrl() Title = "WMS layer (URL)"; - // Initialize the map Initialize(); } private void Initialize() { - // Apply an imagery basemap to the map - Map myMap = new Map(Basemap.CreateImagery()) + // Create a map with basemap and initial viewpoint. + Map myMap = new Map(Basemap.CreateLightGrayCanvas()) { - - // Set the initial viewpoint - InitialViewpoint = new Viewpoint(new MapPoint(25.450, -4.59, SpatialReferences.Wgs84), 1000000) + // Set the initial viewpoint. + InitialViewpoint = new Viewpoint( + new Envelope(-19195297.778679, 512343.939994, -3620418.579987, 8658913.035426, 0.0, 0.0, SpatialReferences.WebMercator)) }; - // Add the map to the mapview + // Add the map to the mapview. MyMapView.Map = myMap; - // Create a new WMS layer displaying the specified layers from the service - WmsLayer myWmsLayer = new WmsLayer(wmsUrl, wmsLayerNames); + // Create a new WMS layer displaying the specified layers from the service. + WmsLayer myWmsLayer = new WmsLayer(_wmsUrl, _wmsLayerNames); - // Add the layer to the map + // Add the layer to the map. myMap.OperationalLayers.Add(myWmsLayer); } } diff --git a/src/Forms/Shared/Samples/Map/OpenScene/OpenScene.jpg b/src/Forms/Shared/Samples/Map/OpenScene/OpenScene.jpg index fcc64d65f6..4698af561e 100644 Binary files a/src/Forms/Shared/Samples/Map/OpenScene/OpenScene.jpg and b/src/Forms/Shared/Samples/Map/OpenScene/OpenScene.jpg differ diff --git a/src/Forms/Shared/Samples/Map/OpenScene/OpenScene.xaml.cs b/src/Forms/Shared/Samples/Map/OpenScene/OpenScene.xaml.cs index 80fcfdd179..cb6ca9bc92 100644 --- a/src/Forms/Shared/Samples/Map/OpenScene/OpenScene.xaml.cs +++ b/src/Forms/Shared/Samples/Map/OpenScene/OpenScene.xaml.cs @@ -17,12 +17,12 @@ namespace ArcGISRuntime.Samples.OpenScene [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Open scene (Portal item)", "Map", - "This sample demonstrates how to open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal.", + "Open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal.", "The sample will load the scene automatically.")] public partial class OpenScene : ContentPage { // Hold the ID of the portal item, which is a web scene. - private const string ItemId = "a13c3c3540144967bc933cb5e498b8e4"; + private const string ItemId = "c6f90b19164c4283884361005faea852"; public OpenScene() { diff --git a/src/Forms/Shared/Samples/Map/OpenScene/readme.md b/src/Forms/Shared/Samples/Map/OpenScene/readme.md index c89b9cd1c1..e6ecbf2241 100644 --- a/src/Forms/Shared/Samples/Map/OpenScene/readme.md +++ b/src/Forms/Shared/Samples/Map/OpenScene/readme.md @@ -1,9 +1,21 @@ -# Open scene (Portal item) +# Open a scene (Portal item) -This sample demonstrates how to open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal. +This sample demonstrates how to open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal. - +![](OpenScene.jpg) -## Instructions +## How to use the sample -The sample will load the scene automatically. +When the sample loads, a scene from ArcGIS Online will be displayed. + +## How it works + +This sample uses the scene portal item constructor to open a scene from ArcGIS Online. + +## Relevant API + +* `Scene.LoadAsync` + +## Tags + +Scenes, Web Scene, Portal \ No newline at end of file diff --git a/src/UWP/ArcGISRuntime.UWP.Viewer/SamplePage.xaml.cs b/src/UWP/ArcGISRuntime.UWP.Viewer/SamplePage.xaml.cs index b433ebca2e..007937bd31 100644 --- a/src/UWP/ArcGISRuntime.UWP.Viewer/SamplePage.xaml.cs +++ b/src/UWP/ArcGISRuntime.UWP.Viewer/SamplePage.xaml.cs @@ -42,7 +42,7 @@ public SamplePage() string readmePath = System.IO.Path.Combine(folderPath, "Readme.md"); string readmeContent = System.IO.File.ReadAllText(readmePath); readmeContent = _markdownRenderer.Parse(readmeContent); - readmeContent = readmeContent.Replace("src=\"", $"src=\"{basePath}\\"); + readmeContent = readmeContent.Replace("src='", "src=\"").Replace(".jpg'", ".jpg\"").Replace("src=\"", $"src=\"{basePath}\\"); string htmlString = "" + readmeContent + ""; DescriptionView.NavigateToString(htmlString); SourceCodeContainer.LoadSourceCode(); diff --git a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.xaml.cs b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.xaml.cs index 1b298ef3a5..2c14909a25 100644 --- a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.xaml.cs +++ b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.xaml.cs @@ -24,12 +24,12 @@ namespace ArcGISRuntime.UWP.Samples.FeatureLayerQuery [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Feature layer query", "Data", - "This sample demonstrates how to return features from a feature layer using an attribute query on the underlying feature table.", + "Query a feature layer via a feature table.", "The sample provides a panel with two controls: a text box where you can input the name of a US State, and a button that executes an attribute query using that value. A successful query will select (highlight) the state and zoom the map to its extent.")] public partial class FeatureLayerQuery { // Create reference to service of US States - private string _statesUrl = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/2"; + private string _statesUrl = "https://services.arcgis.com/jIL9msH9OI208GCb/arcgis/rest/services/USA_Daytime_Population_2016/FeatureServer/0"; // Create globally available feature table for easy referencing private ServiceFeatureTable _featureTable; @@ -61,9 +61,10 @@ private void Initialize() // Create feature layer using this feature table _featureLayer = new FeatureLayer(_featureTable) { - // Set the Opacity of the Feature Layer - Opacity = 0.6 + Opacity = 0.6, + // Work around service setting + MaxScale = 10 }; // Create a new renderer for the States Feature Layer. diff --git a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml.cs b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml.cs index 7c7f5eb285..c7d48968aa 100644 --- a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml.cs +++ b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml.cs @@ -22,12 +22,12 @@ namespace ArcGISRuntime.UWP.Samples.StatsQueryGroupAndSort [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Statistical query group and sort results", "Data", - "This sample demonstrates how to query a feature table to get statistics for a specified field and to group and sort the results.", + "Query a feature table to get grouped, sorted statistics.", "")] public partial class StatsQueryGroupAndSort { // URI for the US states map service - private Uri _usStatesServiceUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3"); + private Uri _usStatesServiceUri = new Uri("https://services.arcgis.com/jIL9msH9OI208GCb/arcgis/rest/services/Counties_Obesity_Inactivity_Diabetes_2013/FeatureServer/0"); // US states feature table private FeatureTable _usStatesTable; @@ -96,6 +96,9 @@ private async void OnExecuteStatisticsQueryClicked(object sender, RoutedEventArg statQueryParams.OrderByFields.Add(orderBy.OrderInfo); } + // Ignore counties with missing data + statQueryParams.WhereClause = "\"State\" IS NOT NULL"; + // Execute the statistical query with these parameters and await the results StatisticsQueryResult statQueryResult = await _usStatesTable.QueryStatisticsAsync(statQueryParams); diff --git a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg index de943efaf0..e32a17e2c9 100644 Binary files a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg and b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg differ diff --git a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.xaml.cs b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.xaml.cs index e28fd2273b..869d0f5f65 100644 --- a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.xaml.cs +++ b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.xaml.cs @@ -21,66 +21,58 @@ namespace ArcGISRuntime.UWP.Samples.FeatureLayerSelection [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Feature layer selection", "Layers", - "This sample demonstrates how to select features in a feature layer by tapping a MapView.", + "Select features by tapping a MapView.", "")] public partial class FeatureLayerSelection { - // Hold reference to the feature layer + // Hold reference to the feature layer. private FeatureLayer _featureLayer; public FeatureLayerSelection() { InitializeComponent(); - - // Setup the control references and execute initialization Initialize(); } private async void Initialize() { - // Create new Map with basemap - Map myMap = new Map(Basemap.CreateTopographic()); + // Create new Map with basemap. + Map myMap = new Map(Basemap.CreateLightGrayCanvas()); - // Create envelope to be used as a target extent for map's initial viewpoint - Envelope myEnvelope = new Envelope( - -1131596.019761, 3893114.069099, 3926705.982140, 7977912.461790, - SpatialReferences.WebMercator); + // Create envelope to be used as a target extent for map's initial viewpoint. + Envelope myEnvelope = new Envelope(-6603299.491810, 1679677.742046, 9002253.947487, 8691318.054732, SpatialReferences.WebMercator); - // Set the initial viewpoint for map + // Set the initial viewpoint for map. myMap.InitialViewpoint = new Viewpoint(myEnvelope); - // Provide used Map to the MapView + // Provide used Map to the MapView. MyMapView.Map = myMap; - // Create Uri for the feature service + // Create Uri for the feature service. Uri featureServiceUri = new Uri( - "http://sampleserver6.arcgisonline.com/arcgis/rest/services/DamageAssessment/FeatureServer/0"); + "https://services1.arcgis.com/4yjifSiIG17X0gW4/arcgis/rest/services/GDP_per_capita_1960_2016/FeatureServer/0"); - // Initialize feature table using a url to feature server url + // Initialize feature table using a URL to feature server. ServiceFeatureTable featureTable = new ServiceFeatureTable(featureServiceUri); - // Initialize a new feature layer based on the feature table + // Initialize a new feature layer based on the feature table. _featureLayer = new FeatureLayer(featureTable) { - - // Set the selection color for feature layer SelectionColor = Color.Cyan, - - // Set the selection width SelectionWidth = 3 }; - // Make sure that used feature layer is loaded before we hook into the tapped event - // This prevents us trying to do selection on the layer that isn't initialized + // Make sure that used feature layer is loaded before hooking into the tapped event + // This prevents trying to do selection on the layer that isn't initialized. await _featureLayer.LoadAsync(); - // Check for the load status. If the layer is loaded then add it to map + // Check for the load status. If the layer is loaded then add it to map. if (_featureLayer.LoadStatus == LoadStatus.Loaded) { - // Add the feature layer to the map + // Add the feature layer to the map. myMap.OperationalLayers.Add(_featureLayer); - // Add tap event handler for mapview + // Add tap event handler for mapview. MyMapView.GeoViewTapped += OnMapViewTapped; } } @@ -89,32 +81,35 @@ private async void OnMapViewTapped(object sender, GeoViewInputEventArgs e) { try { - // Define the selection tolerance - double tolerance = 5; + // Define the selection tolerance. + double tolerance = 15; - // Convert the tolerance to map units + // Convert the tolerance to map units. double mapTolerance = tolerance * MyMapView.UnitsPerPixel; - // Get the tapped point + // Get the tapped point. MapPoint geometry = e.Location; - // Normalize the geometry if wrap-around is enabled - // This is necessary because of how wrapped-around map coordinates are handled by Runtime + // Normalize the geometry if wrap-around is enabled. + // This is necessary because of how wrapped-around map coordinates are handled by Runtime. // Without this step, querying may fail because wrapped-around coordinates are out of bounds. - if (MyMapView.IsWrapAroundEnabled) { geometry = (MapPoint)GeometryEngine.NormalizeCentralMeridian(geometry); } + if (MyMapView.IsWrapAroundEnabled) + { + geometry = (MapPoint)GeometryEngine.NormalizeCentralMeridian(geometry); + } - // Define the envelope around the tap location for selecting features + // Define the envelope around the tap location for selecting features. Envelope selectionEnvelope = new Envelope(geometry.X - mapTolerance, geometry.Y - mapTolerance, geometry.X + mapTolerance, geometry.Y + mapTolerance, MyMapView.Map.SpatialReference); - // Define the query parameters for selecting features + // Define the query parameters for selecting features. QueryParameters queryParams = new QueryParameters { - // Set the geometry to selection envelope for selection by geometry + // Set the geometry to selection envelope for selection by geometry. Geometry = selectionEnvelope }; - // Select the features based on query parameters defined above + // Select the features based on query parameters defined above. await _featureLayer.SelectFeaturesAsync(queryParams, SelectionMode.New); } catch (Exception ex) diff --git a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg index 5144482594..d04d82a5f4 100644 Binary files a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg and b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg differ diff --git a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.xaml.cs b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.xaml.cs index 9f6ca8c01d..54c26f50be 100644 --- a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.xaml.cs +++ b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.xaml.cs @@ -7,9 +7,9 @@ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific // language governing permissions and limitations under the License. +using Esri.ArcGISRuntime.Geometry; using Esri.ArcGISRuntime.Mapping; using Esri.ArcGISRuntime.Rasters; -using Esri.ArcGISRuntime.ArcGISServices; using System; namespace ArcGISRuntime.UWP.Samples.RasterLayerImageServiceRaster @@ -17,51 +17,41 @@ namespace ArcGISRuntime.UWP.Samples.RasterLayerImageServiceRaster [ArcGISRuntime.Samples.Shared.Attributes.Sample( "ArcGIS raster layer (service)", "Layers", - "This sample demonstrates how to show a raster layer on a map based on an image service layer.", + "Add a raster layer from an image service to a map.", "")] public partial class RasterLayerImageServiceRaster { public RasterLayerImageServiceRaster() { InitializeComponent(); - - // Setup the control references and execute initialization Initialize(); } private async void Initialize() { - // Create new map with the dark gray canvas basemap + // Create new map with the dark gray canvas basemap. Map myMap = new Map(Basemap.CreateDarkGrayCanvasVector()); - // Create a Uri to the image service raster - Uri myUri = new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/NLCDLandCover2001/ImageServer"); + // Create a Uri to the image service raster. + Uri myUri = new Uri("https://gis.ngdc.noaa.gov/arcgis/rest/services/bag_hillshades/ImageServer"); - // Create new image service raster from the Uri + // Create new image service raster from the Uri. ImageServiceRaster myImageServiceRaster = new ImageServiceRaster(myUri); - // Load the image service raster + // Load the image service raster. await myImageServiceRaster.LoadAsync(); - // Get the service information (aka. metadata) about the image service raster - ArcGISImageServiceInfo myArcGISImageServiceInfo = myImageServiceRaster.ServiceInfo; - - // Create a new raster layer from the image service raster + // Create a new raster layer from the image service raster. RasterLayer myRasterLayer = new RasterLayer(myImageServiceRaster); - // Add the raster layer to the maps layer collection + // Add the raster layer to the maps layer collection. myMap.Basemap.BaseLayers.Add(myRasterLayer); - // Assign the map to the map view + // Assign the map to the map view. MyMapView.Map = myMap; - // Zoom the map to the extent of the image service raster (which also the extent of the raster layer) - await MyMapView.SetViewpointGeometryAsync(myArcGISImageServiceInfo.FullExtent); - - // NOTE: The sample zooms to the extent of the ImageServiceRaster. Currently the ArcGIS Runtime does not - // support zooming a RasterLayer out beyond 4 times it's published level of detail. The sample uses - // MapView.SetViewpointCenterAsync() method to ensure the image shows when the app starts. You can see - // the effect of the image service not showing when you zoom out to the full extent of the image and beyond. } + // zoom in to the San Francisco Bay. + await MyMapView.SetViewpointCenterAsync(new MapPoint(-13643095.660131, 4550009.846004, SpatialReferences.WebMercator), 100000); } } } diff --git a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg index 8a8963009b..9368d36df7 100644 Binary files a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg and b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg differ diff --git a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.xaml.cs b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.xaml.cs index ff04bcfd18..b22af4e23b 100644 --- a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.xaml.cs +++ b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.xaml.cs @@ -8,6 +8,7 @@ // language governing permissions and limitations under the License. using Esri.ArcGISRuntime.Data; +using Esri.ArcGISRuntime.Geometry; using Esri.ArcGISRuntime.Mapping; namespace ArcGISRuntime.UWP.Samples.ShowLabelsOnLayer @@ -15,7 +16,7 @@ namespace ArcGISRuntime.UWP.Samples.ShowLabelsOnLayer [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Show labels on layer", "Layers", - "This sample demonstrates how to show labels on a feature layer", + "Show labels on a feature layer using a JSON label definition.", "The labeling of the names on the US Highways layer is accomplished by supplying a JSON string to the FeatureLayer's LabelDefinition. The JSON is based on the new ArcGIS web map specification.", "")] public partial class ShowLabelsOnLayer @@ -23,8 +24,6 @@ public partial class ShowLabelsOnLayer public ShowLabelsOnLayer() { InitializeComponent(); - - // Create the map, set the initial extent, and add the US highways feature layer with labeling enabled. Initialize(); } @@ -36,35 +35,62 @@ private async void Initialize() // Assign the map to the MapView. MyMapView.Map = sampleMap; - // Define the Url string for the US highways feature layer. - string highwaysUrlString = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/1"; + // Define the URL string for the feature layer. + string layerUrl = "https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Congressional_Districts_analysis/FeatureServer/0"; - // Create a service feature table from the url to the US highways feature service. - ServiceFeatureTable highwaysServiceFeatureTable = new ServiceFeatureTable(new System.Uri(highwaysUrlString)); + // Create a service feature table from the URL. + ServiceFeatureTable featureTable = new ServiceFeatureTable(new System.Uri(layerUrl)); // Create a feature layer from the service feature table. - FeatureLayer highwaysFeatureLayer = new FeatureLayer(highwaysServiceFeatureTable); + FeatureLayer districtFeatureLabel = new FeatureLayer(featureTable); + + // Add the feature layer to the operations layers collection of the map. + sampleMap.OperationalLayers.Add(districtFeatureLabel); - // Load the US highways feature layer - this way we can obtain it's extent. - await highwaysFeatureLayer.LoadAsync(); + // Load the feature layer - this way we can obtain it's extent. + await districtFeatureLabel.LoadAsync(); - // Zoom the map view to the extent of the US highways feature layer. - await MyMapView.SetViewpointGeometryAsync(highwaysFeatureLayer.FullExtent); + // Zoom the map view to the extent of the feature layer. + await MyMapView.SetViewpointCenterAsync(new MapPoint(-10846309.950860, 4683272.219411, SpatialReferences.WebMercator), 20000000); // Help regarding the Json syntax for defining the LabelDefinition.FromJson syntax can be found here: // https://developers.arcgis.com/web-map-specification/objects/labelingInfo/ // This particular JSON string will have the following characteristics: - // (1) The 'labelExpressionInfo' defines that the label text displayed comes from the field 'rte_num1' in the - // feature service and will be prefaced with an "I -". Example: "I - 10", "I - 15", "I - 95", etc. - // (2) The 'labelPlacement' will be placed above and along the highway polyline segment. - // (3) The 'where' clause restricts the labels to be displayed that has valid (non-empty) data. Empty data - // for this service has a single blank space in the 'rte_num1' field. - // (4) The 'symbol' for the labeled text will be blue with a yellow halo. - string theJSON_String = + string redLabelJson = @"{ - ""labelExpressionInfo"":{""expression"":""'I - ' + $feature.rte_num1""}, - ""labelPlacement"":""esriServerLinePlacementAboveAlong"", - ""where"":""rte_num1 <> ' '"", + ""labelExpressionInfo"":{""expression"":""$feature.NAME + ' (' + left($feature.PARTY,1) + ')\\nDistrict' + $feature.CDFIPS""}, + ""labelPlacement"":""esriServerPolygonPlacementAlwaysHorizontal"", + ""where"":""PARTY = 'Republican'"", + ""symbol"": + { + ""angle"":0, + ""backgroundColor"":[0,0,0,0], + ""borderLineColor"":[0,0,0,0], + ""borderLineSize"":0, + ""color"":[255,0,0,255], + ""font"": + { + ""decoration"":""none"", + ""size"":10, + ""style"":""normal"", + ""weight"":""normal"" + }, + ""haloColor"":[255,255,255,255], + ""haloSize"":2, + ""horizontalAlignment"":""center"", + ""kerning"":false, + ""type"":""esriTS"", + ""verticalAlignment"":""middle"", + ""xoffset"":0, + ""yoffset"":0 + } + }"; + + string blueLabelJson = + @"{ + ""labelExpressionInfo"":{""expression"":""$feature.NAME + ' (' + left($feature.PARTY,1) + ')\\nDistrict' + $feature.CDFIPS""}, + ""labelPlacement"":""esriServerPolygonPlacementAlwaysHorizontal"", + ""where"":""PARTY = 'Democrat'"", ""symbol"": { ""angle"":0, @@ -75,12 +101,12 @@ private async void Initialize() ""font"": { ""decoration"":""none"", - ""size"":15, + ""size"":10, ""style"":""normal"", ""weight"":""normal"" }, - ""haloColor"":[255,255,0,255], - ""haloSize"":1.5, + ""haloColor"":[255,255,255,255], + ""haloSize"":2, ""horizontalAlignment"":""center"", ""kerning"":false, ""type"":""esriTS"", @@ -91,16 +117,15 @@ private async void Initialize() }"; // Create a label definition from the JSON string. - LabelDefinition highwaysLabelDefinition = LabelDefinition.FromJson(theJSON_String); + LabelDefinition redLabelDefinition = LabelDefinition.FromJson(redLabelJson); + LabelDefinition blueLabelDefinition = LabelDefinition.FromJson(blueLabelJson); // Add the label definition to the feature layer's label definition collection. - highwaysFeatureLayer.LabelDefinitions.Add(highwaysLabelDefinition); + districtFeatureLabel.LabelDefinitions.Add(redLabelDefinition); + districtFeatureLabel.LabelDefinitions.Add(blueLabelDefinition); // Enable the visibility of labels to be seen. - highwaysFeatureLayer.LabelsEnabled = true; - - // Add the US highways feature layer to the operations layers collection of the map. - sampleMap.OperationalLayers.Add(highwaysFeatureLayer); + districtFeatureLabel.LabelsEnabled = true; } } diff --git a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg index 9dc9a2c36d..2f90ee6f1c 100644 Binary files a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg and b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg differ diff --git a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/WMSLayerUrl/WMSLayerUrl.xaml.cs b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/WMSLayerUrl/WMSLayerUrl.xaml.cs index 90d3676e37..a755522e1a 100644 --- a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/WMSLayerUrl/WMSLayerUrl.xaml.cs +++ b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Layers/WMSLayerUrl/WMSLayerUrl.xaml.cs @@ -17,15 +17,16 @@ namespace ArcGISRuntime.UWP.Samples.WMSLayerUrl [ArcGISRuntime.Samples.Shared.Attributes.Sample( "WMS layer (URL)", "Layers", - "This sample demonstrates how to add a layer from a WMS service to a map.", + "Add a layer from a WMS service to a map.", "")] public partial class WMSLayerUrl { - // Hold the URL to the WMS service showing the geology of Africa - private Uri wmsUrl = new Uri("https://certmapper.cr.usgs.gov/arcgis/services/geology/africa/MapServer/WMSServer?request=GetCapabilities&service=WMS"); + // Hold the URL to the WMS service showing U.S. weather radar. + private readonly Uri _wmsUrl = new Uri( + "https://nowcoast.noaa.gov/arcgis/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer/WMSServer?request=GetCapabilities&service=WMS"); - // Hold a list of uniquely-identifying WMS layer names to display - private List wmsLayerNames = new List { "0" }; + // Hold a list of uniquely-identifying WMS layer names to display. + private readonly List _wmsLayerNames = new List { "1" }; public WMSLayerUrl() { @@ -36,21 +37,21 @@ public WMSLayerUrl() private void Initialize() { - // Apply an imagery basemap to the map - Map myMap = new Map(Basemap.CreateImagery()) + // Create a map with basemap and initial viewpoint. + Map myMap = new Map(Basemap.CreateLightGrayCanvas()) { - - // Set the initial viewpoint - InitialViewpoint = new Viewpoint(new MapPoint(25.450, -4.59, SpatialReferences.Wgs84), 1000000) + // Set the initial viewpoint. + InitialViewpoint = new Viewpoint( + new Envelope(-19195297.778679, 512343.939994, -3620418.579987, 8658913.035426, 0.0, 0.0, SpatialReferences.WebMercator)) }; - // Add the map to the mapview + // Add the map to the mapview. MyMapView.Map = myMap; - // Create a new WMS layer displaying the specified layers from the service - WmsLayer myWmsLayer = new WmsLayer(wmsUrl, wmsLayerNames); + // Create a new WMS layer displaying the specified layers from the service. + WmsLayer myWmsLayer = new WmsLayer(_wmsUrl, _wmsLayerNames); - // Add the layer to the map + // Add the layer to the map. myMap.OperationalLayers.Add(myWmsLayer); } } diff --git a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Map/OpenScene/OpenScene.jpg b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Map/OpenScene/OpenScene.jpg index fcc64d65f6..f8da0e2462 100644 Binary files a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Map/OpenScene/OpenScene.jpg and b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Map/OpenScene/OpenScene.jpg differ diff --git a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Map/OpenScene/OpenScene.xaml.cs b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Map/OpenScene/OpenScene.xaml.cs index 99183bf8b0..e8921d6bae 100644 --- a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Map/OpenScene/OpenScene.xaml.cs +++ b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Map/OpenScene/OpenScene.xaml.cs @@ -16,12 +16,12 @@ namespace ArcGISRuntime.UWP.Samples.OpenScene [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Open scene (Portal item)", "Map", - "This sample demonstrates how to open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal.", + "Open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal.", "The sample will load the scene automatically.")] public partial class OpenScene { // Hold the ID of the portal item, which is a web scene. - private const string ItemId = "a13c3c3540144967bc933cb5e498b8e4"; + private const string ItemId = "c6f90b19164c4283884361005faea852"; public OpenScene() { diff --git a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Map/OpenScene/readme.md b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Map/OpenScene/readme.md index c89b9cd1c1..e6ecbf2241 100644 --- a/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Map/OpenScene/readme.md +++ b/src/UWP/ArcGISRuntime.UWP.Viewer/Samples/Map/OpenScene/readme.md @@ -1,9 +1,21 @@ -# Open scene (Portal item) +# Open a scene (Portal item) -This sample demonstrates how to open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal. +This sample demonstrates how to open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal. - +![](OpenScene.jpg) -## Instructions +## How to use the sample -The sample will load the scene automatically. +When the sample loads, a scene from ArcGIS Online will be displayed. + +## How it works + +This sample uses the scene portal item constructor to open a scene from ArcGIS Online. + +## Relevant API + +* `Scene.LoadAsync` + +## Tags + +Scenes, Web Scene, Portal \ No newline at end of file diff --git a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.xaml.cs b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.xaml.cs index 0e66d0b20d..b305721fc1 100644 --- a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.xaml.cs +++ b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.xaml.cs @@ -23,12 +23,12 @@ namespace ArcGISRuntime.WPF.Samples.FeatureLayerQuery [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Feature layer query", "Data", - "This sample demonstrates how to query a feature layer via feature table.", + "Query a feature layer via a feature table.", "The sample provides a search bar on the top, where you can input the name of a US State. When you hit search the app performs a query on the feature table and based on the result either highlights the state geometry or provides an error.")] public partial class FeatureLayerQuery { // Create reference to service of US States. - private string _statesUrl = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/2"; + private string _statesUrl = "https://services.arcgis.com/jIL9msH9OI208GCb/arcgis/rest/services/USA_Daytime_Population_2016/FeatureServer/0"; // Create globally available feature table for easy referencing. private ServiceFeatureTable _featureTable; @@ -59,7 +59,9 @@ private void Initialize() // Create feature layer using this feature table. Make it slightly transparent. _featureLayer = new FeatureLayer(_featureTable) { - Opacity = 0.6 + Opacity = 0.6, + // Work around service setting. + MaxScale = 10 }; // Create a new renderer for the States Feature Layer. diff --git a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml index 7cc6fda205..efaa046270 100644 --- a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml +++ b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml @@ -25,7 +25,7 @@ diff --git a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml.cs b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml.cs index ee5a4892e0..3e3c97a570 100644 --- a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml.cs +++ b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml.cs @@ -20,12 +20,12 @@ namespace ArcGISRuntime.WPF.Samples.StatsQueryGroupAndSort [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Statistical query group and sort results", "Data", - "This sample demonstrates how to query a feature table to get statistics for a specified field and to group and sort the results.", + "Query a feature table to get grouped, sorted statistics.", "")] public partial class StatsQueryGroupAndSort { // URI for the US states map service - private Uri _usStatesServiceUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3"); + private Uri _usStatesServiceUri = new Uri("https://services.arcgis.com/jIL9msH9OI208GCb/arcgis/rest/services/Counties_Obesity_Inactivity_Diabetes_2013/FeatureServer/0"); // US states feature table private FeatureTable _usStatesTable; @@ -94,6 +94,9 @@ private async void OnExecuteStatisticsQueryClicked(object sender, RoutedEventArg statQueryParams.OrderByFields.Add(orderBy); } + // Ignore counties with missing data + statQueryParams.WhereClause = "\"State\" IS NOT NULL"; + try { // Execute the statistical query with these parameters and await the results diff --git a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg index 64f285c3c2..d48a39c94c 100644 Binary files a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg and b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg differ diff --git a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.xaml.cs b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.xaml.cs index 8e2da14f29..db7df5fcfd 100644 --- a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.xaml.cs +++ b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.xaml.cs @@ -21,67 +21,58 @@ namespace ArcGISRuntime.WPF.Samples.FeatureLayerSelection [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Feature layer selection", "Layers", - "This sample demonstrates how to select features in a feature layer by tapping a MapView.", + "Select features by tapping a MapView.", "")] public partial class FeatureLayerSelection { - - // Create and hold reference to the feature layer + // Hold a reference to the feature layer. private FeatureLayer _featureLayer; public FeatureLayerSelection() { InitializeComponent(); - - // Create the UI, setup the control references and execute initialization Initialize(); } private async void Initialize() { - // Create new Map with basemap - Map myMap = new Map(Basemap.CreateTopographic()); + // Create new Map with basemap. + Map myMap = new Map(Basemap.CreateLightGrayCanvas()); - // Create envelope to be used as a target extent for map's initial viewpoint - Envelope myEnvelope = new Envelope( - -1131596.019761, 3893114.069099, 3926705.982140, 7977912.461790, - SpatialReferences.WebMercator); + // Create envelope to be used as a target extent for map's initial viewpoint. + Envelope myEnvelope = new Envelope(-6603299.491810, 1679677.742046, 9002253.947487, 8691318.054732, SpatialReferences.WebMercator); - // Set the initial viewpoint for map + // Set the initial viewpoint for map. myMap.InitialViewpoint = new Viewpoint(myEnvelope); - // Provide used Map to the MapView + // Provide used Map to the MapView. MyMapView.Map = myMap; - // Create Uri for the feature service + // Create Uri for the feature service. Uri featureServiceUri = new Uri( - "http://sampleserver6.arcgisonline.com/arcgis/rest/services/DamageAssessment/FeatureServer/0"); + "https://services1.arcgis.com/4yjifSiIG17X0gW4/arcgis/rest/services/GDP_per_capita_1960_2016/FeatureServer/0"); - // Initialize feature table using a url to feature server url + // Initialize feature table using a URL to feature server. ServiceFeatureTable featureTable = new ServiceFeatureTable(featureServiceUri); - // Initialize a new feature layer based on the feature table + // Initialize a new feature layer based on the feature table. _featureLayer = new FeatureLayer(featureTable) { - - // Set the selection color for feature layer SelectionColor = Color.Cyan, - - // Set the selection width SelectionWidth = 3 }; - // Make sure that used feature layer is loaded before we hook into the tapped event - // This prevents us trying to do selection on the layer that isn't initialized + // Make sure that used feature layer is loaded before hooking into the tapped event + // This prevents trying to do selection on the layer that isn't initialized. await _featureLayer.LoadAsync(); - // Check for the load status. If the layer is loaded then add it to map + // Check for the load status. If the layer is loaded then add it to map. if (_featureLayer.LoadStatus == LoadStatus.Loaded) { - // Add the feature layer to the map + // Add the feature layer to the map. myMap.OperationalLayers.Add(_featureLayer); - // Add tap event handler for mapview + // Add tap event handler for mapview. MyMapView.GeoViewTapped += OnMapViewTapped; } } @@ -90,36 +81,36 @@ private async void OnMapViewTapped(object sender, GeoViewInputEventArgs e) { try { - // Define the selection tolerance (half the marker symbol size so that any click on the symbol will select the feature) - double tolerance = 14; + // Define the selection tolerance. + double tolerance = 15; - // Convert the tolerance to map units + // Convert the tolerance to map units. double mapTolerance = tolerance * MyMapView.UnitsPerPixel; - // Get the tapped point + // Get the tapped point. MapPoint geometry = e.Location; - // Normalize the geometry if wrap-around is enabled - // This is necessary because of how wrapped-around map coordinates are handled by Runtime + // Normalize the geometry if wrap-around is enabled. + // This is necessary because of how wrapped-around map coordinates are handled by Runtime. // Without this step, querying may fail because wrapped-around coordinates are out of bounds. if (MyMapView.IsWrapAroundEnabled) { geometry = (MapPoint)GeometryEngine.NormalizeCentralMeridian(geometry); } - // Define the envelope around the tap location for selecting features + // Define the envelope around the tap location for selecting features. Envelope selectionEnvelope = new Envelope(geometry.X - mapTolerance, geometry.Y - mapTolerance, geometry.X + mapTolerance, geometry.Y + mapTolerance, MyMapView.Map.SpatialReference); - // Define the query parameters for selecting features + // Define the query parameters for selecting features. QueryParameters queryParams = new QueryParameters { - // Set the geometry to selection envelope for selection by geometry + // Set the geometry to selection envelope for selection by geometry. Geometry = selectionEnvelope }; - // Select the features based on query parameters defined above - await _featureLayer.SelectFeaturesAsync(queryParams, Esri.ArcGISRuntime.Mapping.SelectionMode.New); + // Select the features based on query parameters defined above. + await _featureLayer.SelectFeaturesAsync(queryParams, SelectionMode.New); } catch (Exception ex) { diff --git a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg index e27e07af52..f75b8358cc 100644 Binary files a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg and b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg differ diff --git a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.xaml.cs b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.xaml.cs index 366c1ccc86..40f2448eed 100644 --- a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.xaml.cs +++ b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.xaml.cs @@ -7,9 +7,9 @@ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific // language governing permissions and limitations under the License. +using Esri.ArcGISRuntime.Geometry; using Esri.ArcGISRuntime.Mapping; using Esri.ArcGISRuntime.Rasters; -using Esri.ArcGISRuntime.ArcGISServices; using System; namespace ArcGISRuntime.WPF.Samples.RasterLayerImageServiceRaster @@ -17,51 +17,41 @@ namespace ArcGISRuntime.WPF.Samples.RasterLayerImageServiceRaster [ArcGISRuntime.Samples.Shared.Attributes.Sample( "ArcGIS raster layer (service)", "Layers", - "This sample demonstrates how to show a raster layer on a map based on an image service layer.", + "Add a raster layer from an image service to a map.", "")] public partial class RasterLayerImageServiceRaster { public RasterLayerImageServiceRaster() { InitializeComponent(); - - // Create the UI, setup the control references and execute initialization Initialize(); } private async void Initialize() { - // Create new map with the dark gray canvas basemap + // Create new map with the dark gray canvas basemap. Map myMap = new Map(Basemap.CreateDarkGrayCanvasVector()); - // Create a Uri to the image service raster - Uri myUri = new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/NLCDLandCover2001/ImageServer"); + // Create a Uri to the image service raster. + Uri myUri = new Uri("https://gis.ngdc.noaa.gov/arcgis/rest/services/bag_hillshades/ImageServer"); - // Create new image service raster from the Uri + // Create new image service raster from the Uri. ImageServiceRaster myImageServiceRaster = new ImageServiceRaster(myUri); - // Load the image service raster + // Load the image service raster. await myImageServiceRaster.LoadAsync(); - // Get the service information (aka. metadata) about the image service raster - ArcGISImageServiceInfo myArcGISImageServiceInfo = myImageServiceRaster.ServiceInfo; - - // Create a new raster layer from the image service raster + // Create a new raster layer from the image service raster. RasterLayer myRasterLayer = new RasterLayer(myImageServiceRaster); - // Add the raster layer to the maps layer collection + // Add the raster layer to the maps layer collection. myMap.Basemap.BaseLayers.Add(myRasterLayer); - // Assign the map to the map view + // Assign the map to the map view. MyMapView.Map = myMap; - // Zoom the map to the extent of the image service raster (which also the extent of the raster layer) - await MyMapView.SetViewpointGeometryAsync(myArcGISImageServiceInfo.FullExtent); - - // NOTE: The sample zooms to the extent of the ImageServiceRaster. Currently the ArcGIS Runtime does not - // support zooming a RasterLayer out beyond 4 times it's published level of detail. The sample uses - // MapView.SetViewpointCenterAsync() method to ensure the image shows when the app starts. You can see - // the effect of the image service not showing when you zoom out to the full extent of the image and beyond. } + // zoom in to the San Francisco Bay. + await MyMapView.SetViewpointCenterAsync(new MapPoint(-13643095.660131, 4550009.846004, SpatialReferences.WebMercator), 100000); } } } diff --git a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg index 57627ff109..8459cb86de 100644 Binary files a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg and b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg differ diff --git a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.xaml.cs b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.xaml.cs index a16531b475..f7fc6bc123 100644 --- a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.xaml.cs +++ b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.xaml.cs @@ -8,6 +8,7 @@ // language governing permissions and limitations under the License. using Esri.ArcGISRuntime.Data; +using Esri.ArcGISRuntime.Geometry; using Esri.ArcGISRuntime.Mapping; namespace ArcGISRuntime.WPF.Samples.ShowLabelsOnLayer @@ -15,7 +16,7 @@ namespace ArcGISRuntime.WPF.Samples.ShowLabelsOnLayer [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Show labels on layer", "Layers", - "This sample demonstrates how to show labels on a feature layer", + "Show labels on a feature layer using a JSON label definition.", "The labeling of the names on the US Highways layer is accomplished by supplying a JSON string to the FeatureLayer's LabelDefinition. The JSON is based on the new ArcGIS web map specification.", "")] public partial class ShowLabelsOnLayer @@ -23,8 +24,6 @@ public partial class ShowLabelsOnLayer public ShowLabelsOnLayer() { InitializeComponent(); - - // Create the map, set the initial extent, and add the US highways feature layer with labeling enabled. Initialize(); } @@ -36,38 +35,62 @@ private async void Initialize() // Assign the map to the MapView. MyMapView.Map = sampleMap; - // Define the Url string for the US highways feature layer. - string highwaysUrlString = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/1"; + // Define the URL string for the feature layer. + string layerUrl = "https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Congressional_Districts_analysis/FeatureServer/0"; - // Create a service feature table from the url to the US highways feature service. - ServiceFeatureTable highwaysServiceFeatureTable = new ServiceFeatureTable(new System.Uri(highwaysUrlString)); + // Create a service feature table from the URL. + ServiceFeatureTable featureTable = new ServiceFeatureTable(new System.Uri(layerUrl)); // Create a feature layer from the service feature table. - FeatureLayer highwaysFeatureLayer = new FeatureLayer(highwaysServiceFeatureTable); + FeatureLayer districtFeatureLabel = new FeatureLayer(featureTable); - // Add the US highways feature layer to the operations layers collection of the map. - sampleMap.OperationalLayers.Add(highwaysFeatureLayer); + // Add the feature layer to the operations layers collection of the map. + sampleMap.OperationalLayers.Add(districtFeatureLabel); - // Load the US highways feature layer - this way we can obtain it's extent. - await highwaysFeatureLayer.LoadAsync(); + // Load the feature layer - this way we can obtain it's extent. + await districtFeatureLabel.LoadAsync(); - // Zoom the map view to the extent of the US highways feature layer. - await MyMapView.SetViewpointGeometryAsync(highwaysFeatureLayer.FullExtent); + // Zoom the map view to the extent of the feature layer. + await MyMapView.SetViewpointCenterAsync(new MapPoint(-10846309.950860, 4683272.219411, SpatialReferences.WebMercator), 20000000); // Help regarding the Json syntax for defining the LabelDefinition.FromJson syntax can be found here: // https://developers.arcgis.com/web-map-specification/objects/labelingInfo/ // This particular JSON string will have the following characteristics: - // (1) The 'labelExpressionInfo' defines that the label text displayed comes from the field 'rte_num1' in the - // feature service and will be prefaced with an "I -". Example: "I - 10", "I - 15", "I - 95", etc. - // (2) The 'labelPlacement' will be placed above and along the highway polyline segment. - // (3) The 'where' clause restricts the labels to be displayed that has valid (non-empty) data. Empty data - // for this service has a single blank space in the 'rte_num1' field. - // (4) The 'symbol' for the labeled text will be blue with a yellow halo. - string theJSON_String = + string redLabelJson = @"{ - ""labelExpressionInfo"":{""expression"":""'I - ' + $feature.rte_num1""}, - ""labelPlacement"":""esriServerLinePlacementAboveAlong"", - ""where"":""rte_num1 <> ' '"", + ""labelExpressionInfo"":{""expression"":""$feature.NAME + ' (' + left($feature.PARTY,1) + ')\\nDistrict' + $feature.CDFIPS""}, + ""labelPlacement"":""esriServerPolygonPlacementAlwaysHorizontal"", + ""where"":""PARTY = 'Republican'"", + ""symbol"": + { + ""angle"":0, + ""backgroundColor"":[0,0,0,0], + ""borderLineColor"":[0,0,0,0], + ""borderLineSize"":0, + ""color"":[255,0,0,255], + ""font"": + { + ""decoration"":""none"", + ""size"":10, + ""style"":""normal"", + ""weight"":""normal"" + }, + ""haloColor"":[255,255,255,255], + ""haloSize"":2, + ""horizontalAlignment"":""center"", + ""kerning"":false, + ""type"":""esriTS"", + ""verticalAlignment"":""middle"", + ""xoffset"":0, + ""yoffset"":0 + } + }"; + + string blueLabelJson = + @"{ + ""labelExpressionInfo"":{""expression"":""$feature.NAME + ' (' + left($feature.PARTY,1) + ')\\nDistrict' + $feature.CDFIPS""}, + ""labelPlacement"":""esriServerPolygonPlacementAlwaysHorizontal"", + ""where"":""PARTY = 'Democrat'"", ""symbol"": { ""angle"":0, @@ -78,12 +101,12 @@ private async void Initialize() ""font"": { ""decoration"":""none"", - ""size"":15, + ""size"":10, ""style"":""normal"", ""weight"":""normal"" }, - ""haloColor"":[255,255,0,255], - ""haloSize"":1.5, + ""haloColor"":[255,255,255,255], + ""haloSize"":2, ""horizontalAlignment"":""center"", ""kerning"":false, ""type"":""esriTS"", @@ -94,13 +117,15 @@ private async void Initialize() }"; // Create a label definition from the JSON string. - LabelDefinition highwaysLabelDefinition = LabelDefinition.FromJson(theJSON_String); + LabelDefinition redLabelDefinition = LabelDefinition.FromJson(redLabelJson); + LabelDefinition blueLabelDefinition = LabelDefinition.FromJson(blueLabelJson); // Add the label definition to the feature layer's label definition collection. - highwaysFeatureLayer.LabelDefinitions.Add(highwaysLabelDefinition); + districtFeatureLabel.LabelDefinitions.Add(redLabelDefinition); + districtFeatureLabel.LabelDefinitions.Add(blueLabelDefinition); // Enable the visibility of labels to be seen. - highwaysFeatureLayer.LabelsEnabled = true; + districtFeatureLabel.LabelsEnabled = true; } } diff --git a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg index 03cb00c723..1cf76077f3 100644 Binary files a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg and b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg differ diff --git a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/WMSLayerUrl/WMSLayerUrl.xaml.cs b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/WMSLayerUrl/WMSLayerUrl.xaml.cs index 1d1b675c37..e512e3713b 100644 --- a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/WMSLayerUrl/WMSLayerUrl.xaml.cs +++ b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Layers/WMSLayerUrl/WMSLayerUrl.xaml.cs @@ -17,41 +17,41 @@ namespace ArcGISRuntime.WPF.Samples.WMSLayerUrl [ArcGISRuntime.Samples.Shared.Attributes.Sample( "WMS layer (URL)", "Layers", - "This sample demonstrates how to add a layer from a WMS service to a map.", + "Add a layer from a WMS service to a map.", "")] public partial class WMSLayerUrl { - // Hold the URL to the WMS service showing the geology of Africa - private Uri wmsUrl = new Uri("https://certmapper.cr.usgs.gov/arcgis/services/geology/africa/MapServer/WMSServer?request=GetCapabilities&service=WMS"); + // Hold the URL to the WMS service showing U.S. weather radar. + private readonly Uri _wmsUrl = new Uri( + "https://nowcoast.noaa.gov/arcgis/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer/WMSServer?request=GetCapabilities&service=WMS"); - // Hold a list of uniquely-identifying WMS layer names to display - private List wmsLayerNames = new List { "0" }; + // Hold a list of uniquely-identifying WMS layer names to display. + private readonly List _wmsLayerNames = new List { "1" }; public WMSLayerUrl() { InitializeComponent(); - // Execute initialization Initialize(); } private void Initialize() { - // Apply an imagery basemap to the map - Map myMap = new Map(Basemap.CreateImagery()) + // Create a map with basemap and initial viewpoint. + Map myMap = new Map(Basemap.CreateLightGrayCanvas()) { - - // Set the initial viewpoint - InitialViewpoint = new Viewpoint(new MapPoint(25.450, -4.59, SpatialReferences.Wgs84), 1000000) + // Set the initial viewpoint. + InitialViewpoint = new Viewpoint( + new Envelope(-19195297.778679, 512343.939994, -3620418.579987, 8658913.035426, 0.0, 0.0, SpatialReferences.WebMercator)) }; - // Add the map to the mapview + // Add the map to the mapview. MyMapView.Map = myMap; - // Create a new WMS layer displaying the specified layers from the service - WmsLayer myWmsLayer = new WmsLayer(wmsUrl, wmsLayerNames); + // Create a new WMS layer displaying the specified layers from the service. + WmsLayer myWmsLayer = new WmsLayer(_wmsUrl, _wmsLayerNames); - // Add the layer to the map + // Add the layer to the map. myMap.OperationalLayers.Add(myWmsLayer); } } diff --git a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Map/OpenScene/OpenScene.jpg b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Map/OpenScene/OpenScene.jpg index a9ca5373ab..13b018646d 100644 Binary files a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Map/OpenScene/OpenScene.jpg and b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Map/OpenScene/OpenScene.jpg differ diff --git a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Map/OpenScene/OpenScene.xaml.cs b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Map/OpenScene/OpenScene.xaml.cs index 4e325b0a04..dda14308f7 100644 --- a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Map/OpenScene/OpenScene.xaml.cs +++ b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Map/OpenScene/OpenScene.xaml.cs @@ -16,12 +16,12 @@ namespace ArcGISRuntime.WPF.Samples.OpenScene [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Open scene (Portal item)", "Map", - "This sample demonstrates how to open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal.", + "Open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal.", "The sample will load the scene automatically.")] public partial class OpenScene { // Hold the ID of the portal item, which is a web scene. - private const string ItemId = "a13c3c3540144967bc933cb5e498b8e4"; + private const string ItemId = "c6f90b19164c4283884361005faea852"; public OpenScene() { diff --git a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Map/OpenScene/readme.md b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Map/OpenScene/readme.md index c89b9cd1c1..e6ecbf2241 100644 --- a/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Map/OpenScene/readme.md +++ b/src/WPF/ArcGISRuntime.WPF.Viewer/Samples/Map/OpenScene/readme.md @@ -1,9 +1,21 @@ -# Open scene (Portal item) +# Open a scene (Portal item) -This sample demonstrates how to open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal. +This sample demonstrates how to open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal. - +![](OpenScene.jpg) -## Instructions +## How to use the sample -The sample will load the scene automatically. +When the sample loads, a scene from ArcGIS Online will be displayed. + +## How it works + +This sample uses the scene portal item constructor to open a scene from ArcGIS Online. + +## Relevant API + +* `Scene.LoadAsync` + +## Tags + +Scenes, Web Scene, Portal \ No newline at end of file diff --git a/src/iOS/Xamarin.iOS/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.cs b/src/iOS/Xamarin.iOS/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.cs index e33cc0f44c..eb96fd23a6 100644 --- a/src/iOS/Xamarin.iOS/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.cs +++ b/src/iOS/Xamarin.iOS/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.cs @@ -27,7 +27,7 @@ namespace ArcGISRuntime.Samples.FeatureLayerQuery [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Feature layer query", "Data", - "This sample demonstrates how to query a feature layer via feature table.", + "Query a feature layer via a feature table.", "The sample provides a search bar on the top, where you can input the name of a US State. When you hit search the app performs a query on the feature table and based on the result either highlights the state geometry or provides an error.")] public class FeatureLayerQuery : UIViewController { @@ -102,7 +102,9 @@ private void Initialize() _featureLayer = new FeatureLayer(_featureTable) { // Set the Opacity of the Feature Layer. - Opacity = 0.6 + Opacity = 0.6, + // Work around service setting + MaxScale = 10 }; // Create a new renderer for the States Feature Layer. diff --git a/src/iOS/Xamarin.iOS/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.cs b/src/iOS/Xamarin.iOS/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.cs index 46103c59c5..1fc71cd367 100644 --- a/src/iOS/Xamarin.iOS/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.cs +++ b/src/iOS/Xamarin.iOS/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.cs @@ -22,7 +22,7 @@ namespace ArcGISRuntime.Samples.StatsQueryGroupAndSort [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Group and sort statistics", "Data", - "This sample demonstrates how to query a feature table to get statistics for a specified field and to group and sort the results.", + "Query a feature table to get grouped, sorted statistics.", "")] public class StatsQueryGroupAndSort : UIViewController { @@ -35,7 +35,7 @@ public class StatsQueryGroupAndSort : UIViewController private UIButton _getStatsButton; // URI for the US states map service. - private readonly Uri _usStatesServiceUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3"); + private readonly Uri _usStatesServiceUri = new Uri("https://services.arcgis.com/jIL9msH9OI208GCb/arcgis/rest/services/Counties_Obesity_Inactivity_Diabetes_2013/FeatureServer/0"); // US states feature table. private FeatureTable _usStatesTable; @@ -267,6 +267,9 @@ private async void ExecuteStatisticsQuery(object sender, EventArgs e) } } + // Ignore counties with missing data + statQueryParams.WhereClause = "\"State\" IS NOT NULL"; + // Execute the statistical query with these parameters and await the results. try { diff --git a/src/iOS/Xamarin.iOS/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.cs b/src/iOS/Xamarin.iOS/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.cs index 8c0f296fb2..64703511da 100644 --- a/src/iOS/Xamarin.iOS/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.cs +++ b/src/iOS/Xamarin.iOS/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.cs @@ -23,7 +23,7 @@ namespace ArcGISRuntime.Samples.FeatureLayerSelection [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Feature layer selection", "Layers", - "This sample demonstrates how to select features in a feature layer by tapping a MapView.", + "Select features by tapping a MapView.", "")] public class FeatureLayerSelection : UIViewController { @@ -62,41 +62,40 @@ public override void ViewDidLoad() private async void Initialize() { // Create new Map with basemap. - Map map = new Map(Basemap.CreateTopographic()); + Map myMap = new Map(Basemap.CreateLightGrayCanvas()); // Create envelope to be used as a target extent for map's initial viewpoint. - Envelope envelope = new Envelope(-1131596.019761, 3893114.069099, 3926705.982140, 7977912.461790, SpatialReferences.WebMercator); + Envelope myEnvelope = new Envelope(-6603299.491810, 1679677.742046, 9002253.947487, 8691318.054732, SpatialReferences.WebMercator); // Set the initial viewpoint for map. - map.InitialViewpoint = new Viewpoint(envelope); + myMap.InitialViewpoint = new Viewpoint(myEnvelope); // Provide used Map to the MapView. - _myMapView.Map = map; + _myMapView.Map = myMap; - // Create URI for the feature service. - Uri featureServiceUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/DamageAssessment/FeatureServer/0"); + // Create Uri for the feature service. + Uri featureServiceUri = new Uri( + "https://services1.arcgis.com/4yjifSiIG17X0gW4/arcgis/rest/services/GDP_per_capita_1960_2016/FeatureServer/0"); - // Initialize feature table using a URL to feature server URL. + // Initialize feature table using a URL to feature server. ServiceFeatureTable featureTable = new ServiceFeatureTable(featureServiceUri); // Initialize a new feature layer based on the feature table. _featureLayer = new FeatureLayer(featureTable) { - // Set the selection color for feature layer. SelectionColor = Color.Cyan, - // Set the selection width. SelectionWidth = 3 }; - // Make sure that used feature layer is loaded before we hook into the tapped event. - // This prevents attempting to select on the layer that isn't initialized. + // Make sure that used feature layer is loaded before hooking into the tapped event + // This prevents trying to do selection on the layer that isn't initialized. await _featureLayer.LoadAsync(); // Check for the load status. If the layer is loaded then add it to map. if (_featureLayer.LoadStatus == LoadStatus.Loaded) { // Add the feature layer to the map. - map.OperationalLayers.Add(_featureLayer); + myMap.OperationalLayers.Add(_featureLayer); // Add tap event handler for mapview. _myMapView.GeoViewTapped += OnMapViewTapped; @@ -106,7 +105,7 @@ private async void Initialize() private async void OnMapViewTapped(object sender, GeoViewInputEventArgs e) { // Define the selection tolerance. - double tolerance = 25; + double tolerance = 15; // Convert the tolerance to map units. double mapTolerance = tolerance * _myMapView.UnitsPerPixel; diff --git a/src/iOS/Xamarin.iOS/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg b/src/iOS/Xamarin.iOS/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg index a7903b5453..5a901aa585 100644 Binary files a/src/iOS/Xamarin.iOS/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg and b/src/iOS/Xamarin.iOS/Samples/Layers/FeatureLayerSelection/FeatureLayerSelection.jpg differ diff --git a/src/iOS/Xamarin.iOS/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.cs b/src/iOS/Xamarin.iOS/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.cs index 250f496ed0..bd393a1912 100644 --- a/src/iOS/Xamarin.iOS/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.cs +++ b/src/iOS/Xamarin.iOS/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.cs @@ -8,7 +8,7 @@ // language governing permissions and limitations under the License. using System; -using Esri.ArcGISRuntime.ArcGISServices; +using Esri.ArcGISRuntime.Geometry; using Esri.ArcGISRuntime.Mapping; using Esri.ArcGISRuntime.Rasters; using Esri.ArcGISRuntime.UI.Controls; @@ -21,7 +21,7 @@ namespace ArcGISRuntime.Samples.RasterLayerImageServiceRaster [ArcGISRuntime.Samples.Shared.Attributes.Sample( "ArcGIS raster layer (service)", "Layers", - "This sample demonstrates how to show a raster layer on a map based on an image service layer.", + "Add a raster layer from an image service to a map.", "")] public class RasterLayerImageServiceRaster : UIViewController { @@ -59,18 +59,15 @@ private async void Initialize() // Create new map with the dark gray canvas basemap. Map myMap = new Map(Basemap.CreateDarkGrayCanvasVector()); - // Create a URI to the image service raster. - Uri uri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/NLCDLandCover2001/ImageServer"); + // Create a Uri to the image service raster. + Uri uri = new Uri("https://gis.ngdc.noaa.gov/arcgis/rest/services/bag_hillshades/ImageServer"); - // Create new image service raster from the URI. + // Create new image service raster from the Uri. ImageServiceRaster imageServiceRaster = new ImageServiceRaster(uri); // Load the image service raster. await imageServiceRaster.LoadAsync(); - // Get the service information (aka. metadata) about the image service raster. - ArcGISImageServiceInfo arcGISImageServiceInfo = imageServiceRaster.ServiceInfo; - // Create a new raster layer from the image service raster. RasterLayer rasterLayer = new RasterLayer(imageServiceRaster); @@ -80,8 +77,8 @@ private async void Initialize() // Assign the map to the map view. _myMapView.Map = myMap; - // Zoom the map to the extent of the image service raster (which also the extent of the raster layer). - await _myMapView.SetViewpointGeometryAsync(arcGISImageServiceInfo.FullExtent); + // zoom in to the San Francisco Bay. + await _myMapView.SetViewpointCenterAsync(new MapPoint(-13643095.660131, 4550009.846004, SpatialReferences.WebMercator), 100000); } } } \ No newline at end of file diff --git a/src/iOS/Xamarin.iOS/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg b/src/iOS/Xamarin.iOS/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg index e1488d5ba5..af693dbdb4 100644 Binary files a/src/iOS/Xamarin.iOS/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg and b/src/iOS/Xamarin.iOS/Samples/Layers/RasterLayerImageServiceRaster/RasterLayerImageServiceRaster.jpg differ diff --git a/src/iOS/Xamarin.iOS/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.cs b/src/iOS/Xamarin.iOS/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.cs index ee0b1e97fc..0110fffda6 100644 --- a/src/iOS/Xamarin.iOS/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.cs +++ b/src/iOS/Xamarin.iOS/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.cs @@ -21,7 +21,7 @@ namespace ArcGISRuntime.Samples.ShowLabelsOnLayer [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Show labels on layer", "Layers", - "This sample demonstrates how to show labels on a feature layer", + "Show labels on a feature layer using a JSON label definition.", "The labeling of the names on the US Highways layer is accomplished by supplying a JSON string to the FeatureLayer's LabelDefinition. The JSON is based on the new ArcGIS web map specification.", "")] public class ShowLabelsOnLayer : UIViewController @@ -58,43 +58,67 @@ public override void ViewDidLoad() private async void Initialize() { // Create a map with a light gray canvas basemap. - Map sampleMap = new Map(Basemap.CreateLightGrayCanvas()) - { - InitialViewpoint = new Viewpoint(new MapPoint(-100.175709, 39.221225, SpatialReferences.Wgs84), 20000000) - }; + Map sampleMap = new Map(Basemap.CreateLightGrayCanvas()); // Assign the map to the MapView. _myMapView.Map = sampleMap; - // Define the URL string for the US highways feature layer. - string highwaysUrlString = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/1"; + // Define the URL string for the feature layer. + string layerUrl = "https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Congressional_Districts_analysis/FeatureServer/0"; - // Create a service feature table from the URL to the US highways feature service. - ServiceFeatureTable highwaysServiceFeatureTable = new ServiceFeatureTable(new Uri(highwaysUrlString)); + // Create a service feature table from the URL. + ServiceFeatureTable featureTable = new ServiceFeatureTable(new System.Uri(layerUrl)); // Create a feature layer from the service feature table. - FeatureLayer highwaysFeatureLayer = new FeatureLayer(highwaysServiceFeatureTable); + FeatureLayer districtFeatureLabel = new FeatureLayer(featureTable); - // Add the US highways feature layer to the operations layers collection of the map. - sampleMap.OperationalLayers.Add(highwaysFeatureLayer); + // Add the feature layer to the operations layers collection of the map. + sampleMap.OperationalLayers.Add(districtFeatureLabel); - // Load the US highways feature layer - this way we can obtain it's extent. - await highwaysFeatureLayer.LoadAsync(); + // Load the feature layer - this way we can obtain it's extent. + await districtFeatureLabel.LoadAsync(); - // Help regarding the JSON syntax for defining the LabelDefinition.FromJson syntax can be found here: + // Zoom the map view to the extent of the feature layer. + await _myMapView.SetViewpointCenterAsync(new MapPoint(-10846309.950860, 4683272.219411, SpatialReferences.WebMercator), 20000000); + + // Help regarding the Json syntax for defining the LabelDefinition.FromJson syntax can be found here: // https://developers.arcgis.com/web-map-specification/objects/labelingInfo/ // This particular JSON string will have the following characteristics: - // (1) The 'labelExpressionInfo' defines that the label text displayed comes from the field 'rte_num1' in the - // feature service and will be prefaced with an "I -". Example: "I - 10", "I - 15", "I - 95", etc. - // (2) The 'labelPlacement' will be placed above and along the highway polyline segment. - // (3) The 'where' clause restricts the labels to be displayed that has valid (non-empty) data. Empty data - // for this service has a single blank space in the 'rte_num1' field. - // (4) The 'symbol' for the labeled text will be blue with a yellow halo. - string theJsonString = + string redLabelJson = + @"{ + ""labelExpressionInfo"":{""expression"":""$feature.NAME + ' (' + left($feature.PARTY,1) + ')\\nDistrict' + $feature.CDFIPS""}, + ""labelPlacement"":""esriServerPolygonPlacementAlwaysHorizontal"", + ""where"":""PARTY = 'Republican'"", + ""symbol"": + { + ""angle"":0, + ""backgroundColor"":[0,0,0,0], + ""borderLineColor"":[0,0,0,0], + ""borderLineSize"":0, + ""color"":[255,0,0,255], + ""font"": + { + ""decoration"":""none"", + ""size"":10, + ""style"":""normal"", + ""weight"":""normal"" + }, + ""haloColor"":[255,255,255,255], + ""haloSize"":2, + ""horizontalAlignment"":""center"", + ""kerning"":false, + ""type"":""esriTS"", + ""verticalAlignment"":""middle"", + ""xoffset"":0, + ""yoffset"":0 + } + }"; + + string blueLabelJson = @"{ - ""labelExpressionInfo"":{""expression"":""'I - ' + $feature.rte_num1""}, - ""labelPlacement"":""esriServerLinePlacementAboveAlong"", - ""where"":""rte_num1 <> ' '"", + ""labelExpressionInfo"":{""expression"":""$feature.NAME + ' (' + left($feature.PARTY,1) + ')\\nDistrict' + $feature.CDFIPS""}, + ""labelPlacement"":""esriServerPolygonPlacementAlwaysHorizontal"", + ""where"":""PARTY = 'Democrat'"", ""symbol"": { ""angle"":0, @@ -105,12 +129,12 @@ private async void Initialize() ""font"": { ""decoration"":""none"", - ""size"":15, + ""size"":10, ""style"":""normal"", ""weight"":""normal"" }, - ""haloColor"":[255,255,0,255], - ""haloSize"":1.5, + ""haloColor"":[255,255,255,255], + ""haloSize"":2, ""horizontalAlignment"":""center"", ""kerning"":false, ""type"":""esriTS"", @@ -121,13 +145,15 @@ private async void Initialize() }"; // Create a label definition from the JSON string. - LabelDefinition highwaysLabelDefinition = LabelDefinition.FromJson(theJsonString); + LabelDefinition redLabelDefinition = LabelDefinition.FromJson(redLabelJson); + LabelDefinition blueLabelDefinition = LabelDefinition.FromJson(blueLabelJson); // Add the label definition to the feature layer's label definition collection. - highwaysFeatureLayer.LabelDefinitions.Add(highwaysLabelDefinition); + districtFeatureLabel.LabelDefinitions.Add(redLabelDefinition); + districtFeatureLabel.LabelDefinitions.Add(blueLabelDefinition); // Enable the visibility of labels to be seen. - highwaysFeatureLayer.LabelsEnabled = true; + districtFeatureLabel.LabelsEnabled = true; } } } \ No newline at end of file diff --git a/src/iOS/Xamarin.iOS/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg b/src/iOS/Xamarin.iOS/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg index 908569b66f..53d40b1dac 100644 Binary files a/src/iOS/Xamarin.iOS/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg and b/src/iOS/Xamarin.iOS/Samples/Layers/ShowLabelsOnLayer/ShowLabelsOnLayer.jpg differ diff --git a/src/iOS/Xamarin.iOS/Samples/Layers/WMSLayerUrl/WMSLayerUrl.cs b/src/iOS/Xamarin.iOS/Samples/Layers/WMSLayerUrl/WMSLayerUrl.cs index 57bcdbcba2..d31b9cc9a5 100644 --- a/src/iOS/Xamarin.iOS/Samples/Layers/WMSLayerUrl/WMSLayerUrl.cs +++ b/src/iOS/Xamarin.iOS/Samples/Layers/WMSLayerUrl/WMSLayerUrl.cs @@ -21,18 +21,19 @@ namespace ArcGISRuntime.Samples.WMSLayerUrl [ArcGISRuntime.Samples.Shared.Attributes.Sample( "WMS layer (URL)", "Layers", - "This sample demonstrates how to add a layer from a WMS service to a map.", + "Add a layer from a WMS service to a map.", "")] public class WMSLayerUrl : UIViewController { // Create and hold a reference to the MapView. private MapView _myMapView; - // Hold the URL to the WMS service showing the geology of Africa. - private readonly Uri _wmsUrl = new Uri("https://certmapper.cr.usgs.gov/arcgis/services/geology/africa/MapServer/WMSServer?request=GetCapabilities&service=WMS"); + // Hold the URL to the WMS service showing U.S. weather radar. + private readonly Uri _wmsUrl = new Uri( + "https://nowcoast.noaa.gov/arcgis/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer/WMSServer?request=GetCapabilities&service=WMS"); // Hold a list of uniquely-identifying WMS layer names to display. - private readonly List _wmsLayerNames = new List {"0"}; + private readonly List _wmsLayerNames = new List { "1" }; public WMSLayerUrl() { @@ -62,13 +63,15 @@ public override void ViewDidLoad() private void Initialize() { - // Apply an imagery basemap to the map and set the viewpoint to a zoomed-in part of Africa. - Map myMap = new Map(Basemap.CreateImagery()) + // Create a map with basemap and initial viewpoint. + Map myMap = new Map(Basemap.CreateLightGrayCanvas()) { - InitialViewpoint = new Viewpoint(new MapPoint(25.450, -4.59, SpatialReferences.Wgs84), 1000000) + // Set the initial viewpoint. + InitialViewpoint = new Viewpoint( + new Envelope(-19195297.778679, 512343.939994, -3620418.579987, 8658913.035426, 0.0, 0.0, SpatialReferences.WebMercator)) }; - // Show the map. + // Add the map to the mapview. _myMapView.Map = myMap; // Create a new WMS layer displaying the specified layers from the service. diff --git a/src/iOS/Xamarin.iOS/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg b/src/iOS/Xamarin.iOS/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg index 9f5ed56c18..ff2a70d248 100644 Binary files a/src/iOS/Xamarin.iOS/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg and b/src/iOS/Xamarin.iOS/Samples/Layers/WMSLayerUrl/WMSLayerUrl.jpg differ diff --git a/src/iOS/Xamarin.iOS/Samples/Map/OpenScene/OpenScene.cs b/src/iOS/Xamarin.iOS/Samples/Map/OpenScene/OpenScene.cs index 12f4cc8d7b..dee9437c87 100644 --- a/src/iOS/Xamarin.iOS/Samples/Map/OpenScene/OpenScene.cs +++ b/src/iOS/Xamarin.iOS/Samples/Map/OpenScene/OpenScene.cs @@ -20,12 +20,12 @@ namespace ArcGISRuntime.Samples.OpenScene [ArcGISRuntime.Samples.Shared.Attributes.Sample( "Open scene (Portal item)", "Map", - "This sample demonstrates how to open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal.", + "Open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal.", "The sample will load the scene automatically.")] public class OpenScene : UIViewController { // Hold the ID of the portal item, which is a web scene. - private const string ItemId = "a13c3c3540144967bc933cb5e498b8e4"; + private const string ItemId = "c6f90b19164c4283884361005faea852"; // Create the scene view. private SceneView _mySceneView; diff --git a/src/iOS/Xamarin.iOS/Samples/Map/OpenScene/OpenScene.jpg b/src/iOS/Xamarin.iOS/Samples/Map/OpenScene/OpenScene.jpg index 884a6acf44..23a55e4b22 100644 Binary files a/src/iOS/Xamarin.iOS/Samples/Map/OpenScene/OpenScene.jpg and b/src/iOS/Xamarin.iOS/Samples/Map/OpenScene/OpenScene.jpg differ diff --git a/src/iOS/Xamarin.iOS/Samples/Map/OpenScene/readme.md b/src/iOS/Xamarin.iOS/Samples/Map/OpenScene/readme.md index c89b9cd1c1..e6ecbf2241 100644 --- a/src/iOS/Xamarin.iOS/Samples/Map/OpenScene/readme.md +++ b/src/iOS/Xamarin.iOS/Samples/Map/OpenScene/readme.md @@ -1,9 +1,21 @@ -# Open scene (Portal item) +# Open a scene (Portal item) -This sample demonstrates how to open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal. +This sample demonstrates how to open a scene from a Portal item. Just like Web Maps are the ArcGIS format for maps, Web Scenes are the ArcGIS format for scenes. These scenes can be stored in ArcGIS Online or Portal. - +![](OpenScene.jpg) -## Instructions +## How to use the sample -The sample will load the scene automatically. +When the sample loads, a scene from ArcGIS Online will be displayed. + +## How it works + +This sample uses the scene portal item constructor to open a scene from ArcGIS Online. + +## Relevant API + +* `Scene.LoadAsync` + +## Tags + +Scenes, Web Scene, Portal \ No newline at end of file