Skip to content

Commit

Permalink
Sample cartography updates (#526)
Browse files Browse the repository at this point in the history
* WMS layer URL updates for all platforms

Only tested and screenshotted for Windows.

* Open Scene (portal item) data updated

Tested and screenshots taken for Windows only

* Raster layer URL - data update

Tested and screenshots taken for Windows only

* Update data for show labels on layer

Tested and screenshots taken for Windows only

* Feature layer selection data update

Tested and screenshots taken on Windows only

* Updated data for stats query group sort

Tested on Windows only

* Update data source for feature layer query

No substantive code changes. Tested on Windows

* Android screenshots

* Forms screenshots

* iOS screenshots

* Readme updates

* Update UWP viewer to better handle different readme formats

Problem was related to how image tags are rendered by the markdown tool.

* Update forms viewer to better handle diff. readme formats
  • Loading branch information
nCastle1 authored Sep 18, 2018
1 parent ad4ae35 commit c1766f0
Show file tree
Hide file tree
Showing 68 changed files with 696 additions and 547 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,22 @@
using Esri.ArcGISRuntime.UI.Controls;
using System;
using System.Drawing;
using Esri.ArcGISRuntime;

namespace ArcGISRuntime.Samples.FeatureLayerSelection
{
[Activity]
[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)
Expand All @@ -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);
}
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -22,68 +22,59 @@ 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)
{
base.OnCreate(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);
}
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c1766f0

Please sign in to comment.