Click or drag to resize

LayerCollection Class

A collection of layers
Inheritance Hierarchy
SystemObject
  Esri.ArcGISRuntimeRuntimeCollectionLayer
    Esri.ArcGISRuntimeRuntimeObservableCollectionLayer
      Esri.ArcGISRuntime.MappingLayerCollection

Namespace:  Esri.ArcGISRuntime.Mapping
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.11.0
Syntax
public class LayerCollection : RuntimeObservableCollection<Layer>

The LayerCollection type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleLayerCollection
Initializes a new instance of the LayerCollection class.
Top
Properties
Methods
  NameDescription
Public methodCode exampleAdd
Adds an item to the collection.
(Inherited from RuntimeCollectionT.)
Public methodAddRange (Inherited from RuntimeObservableCollectionT.)
Protected methodBlockReentrancy
Disallow reentrant attempts to change this collection. E.g. a event handler of the CollectionChanged event is not allowed to make changes to this collection.
(Inherited from RuntimeObservableCollectionT.)
Protected methodCheckReentrancy
Check and assert for reentrant attempts to change this collection.
(Inherited from RuntimeObservableCollectionT.)
Public methodCode exampleClear
Removes all items from the collection
(Inherited from RuntimeCollectionT.)
Protected methodClearItems
Called by base class Collection<T> when the list is being cleared; raises a CollectionChanged event to any listeners.
(Inherited from RuntimeObservableCollectionT.)
Public methodCode exampleContains
Determines whether the collection contains a specific value.
(Inherited from RuntimeCollectionT.)
Public methodCopyTo
Copies the elements of the collection to an Array, starting at a particular Array index.
(Inherited from RuntimeCollectionT.)
Public methodCode exampleGetEnumerator
Returns an enumerator that iterates through the collection.
(Inherited from RuntimeCollectionT.)
Public methodCode exampleIndexOf
Determines the index of a specific item in the collection.
(Inherited from RuntimeCollectionT.)
Public methodCode exampleInsert
Inserts an item to the collection at the specified index.
(Inherited from RuntimeCollectionT.)
Protected methodInsertItem
Called by base class Collection<T> when an item is added to list; raises a CollectionChanged event to any listeners.
(Inherited from RuntimeObservableCollectionT.)
Public methodMove
Moves the item at the specified index to a new location in the collection.
(Inherited from RuntimeCollectionT.)
Protected methodMoveItem
Called by base class ObservableCollection<T> when an item is to be moved within the list; raises a CollectionChanged event to any listeners.
(Inherited from RuntimeObservableCollectionT.)
Protected methodOnCollectionChanged
Raises the CollectionChanged event with the provided arguments.
(Inherited from RuntimeObservableCollectionT.)
Protected methodOnPropertyChanged
Raises a PropertyChanged event (per INotifyPropertyChanged).
(Inherited from RuntimeObservableCollectionT.)
Public methodCode exampleRemove
Removes the first occurrence of a specific object from the collection
(Inherited from RuntimeCollectionT.)
Public methodCode exampleRemoveAt
Removes the item at the specified index.
(Inherited from RuntimeCollectionT.)
Protected methodRemoveItem
Called by base class Collection<T> when an item is removed from list; raises a CollectionChanged event to any listeners.
(Inherited from RuntimeObservableCollectionT.)
Protected methodSetItem
Called by base class Collection<T> when an item is set in list; raises a CollectionChanged event to any listeners.
(Inherited from RuntimeObservableCollectionT.)
Top
Events
Examples

WPF

Example Name: RasterLayerFile

Create and use a raster layer made from a local raster file.

Code example screen shot.

C#
// Copyright 2017 Esri.
// 
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
// "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 System;
using System.Windows;
using ArcGISRuntime.Samples.Managers;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Rasters;

namespace ArcGISRuntime.WPF.Samples.RasterLayerFile
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        name: "Raster layer (file)",
        category: "Layers",
        description: "Create and use a raster layer made from a local raster file.",
        instructions: "When the sample starts, a raster will be loaded from a file and displayed in the map view.",
        tags: new[] { "data", "image", "import", "layer", "raster", "visualization" })]
    [ArcGISRuntime.Samples.Shared.Attributes.OfflineData("7c4c679ab06a4df19dc497f577f111bd")]
    public partial class RasterLayerFile
    {
        public RasterLayerFile()
        {
            InitializeComponent();

            // Call a function to set up the map
            Initialize();
        }

        private async void Initialize()
        {
            // Add an imagery basemap
            Map myMap = new Map(BasemapStyle.ArcGISImageryStandard);

            // Get the file name
            string filepath = GetRasterPath();

            // Load the raster file
            Raster myRasterFile = new Raster(filepath);

            // Create the layer
            RasterLayer myRasterLayer = new RasterLayer(myRasterFile);

            // Add the layer to the map
            myMap.OperationalLayers.Add(myRasterLayer);

            // Add map to the mapview
            MyMapView.Map = myMap;

            try
            {
                // Wait for the layer to load
                await myRasterLayer.LoadAsync();

                // Set the viewpoint
                await MyMapView.SetViewpointGeometryAsync(myRasterLayer.FullExtent);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Error");
            }
        }

        private static string GetRasterPath()
        {
            return DataManager.GetDataFolder("7c4c679ab06a4df19dc497f577f111bd", "raster-file", "Shasta.tif");
        }
    }
}
XAML
<UserControl x:Class="ArcGISRuntime.WPF.Samples.RasterLayerFile.RasterLayerFile"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
    <Grid>
        <esri:MapView x:Name="MyMapView" />
    </Grid>
</UserControl>
See Also
Additional Examples
Hyperlink to ExampleDescription
AddAnIntegratedMeshLayerView an integrated mesh layer from a scene service.
AddEncExchangeSetDisplay nautical charts per the ENC specification.
AddFeaturesAdd features to a feature layer.
AddPointSceneLayerView a point scene layer from a scene service.
AnalyzeHotspotsUse a geoprocessing service and a set of features to identify statistically significant hot spots and cold spots.
ApplyMosaicRuleApply mosaic rule to a mosaic dataset of rasters.
ArcGISMapImageLayerUrlAdd an ArcGIS Map Image Layer from a URL to a map.
ArcGISTiledLayerUrlLoad an ArcGIS tiled layer from a URL.
AuthorMapCreate and save a map as an ArcGIS `PortalItem` (i.e. web map).
BrowseWfsLayersBrowse a WFS service for layers and add them to the map.
BufferListGenerate multiple individual buffers or a single unioned buffer around multiple points.
ChangeEncDisplaySettingsConfigure the display of ENC content.
ChangeFeatureLayerRendererChange the appearance of a feature layer with a renderer.
ChangeStretchRendererUse a stretch renderer to enhance the visual contrast of raster data for analysis.
ChangeSublayerRendererApply a renderer to a sublayer.
ChangeSublayerVisibilityChange the visibility of sublayers.
ChangeTimeExtentFilter data in layers by applying a time extent to a MapView.
ClosestFacilityStaticFind routes from several locations to the respective closest facility.
ControlAnnotationSublayerVisibilityUse annotation sublayers to gain finer control of annotation layer subtypes.
CreateAndSaveKmlFileConstruct a KML document and save it as a KMZ file.
CreateFeatureCollectionLayerCreate a Feature Collection Layer from a Feature Collection Table, and add it to a map.
CustomDictionaryStyleUse a custom dictionary style (.stylx) to symbolize features using a variety of attribute values.
DeleteFeaturesDelete features from an online feature service.
DisplayAnnotationDisplay annotation from a feature service URL.
DisplayDrawingStatusGet the draw status of your map view or scene view to know when all layers in the map or scene have finished drawing.
DisplayKmlDisplay KML from a URL, portal item, or local KML file.
DisplayKmlNetworkLinksDisplay a file with a KML network link, including displaying any network link control messages at launch.
DisplayLayerViewStateDetermine if a layer is currently being viewed.
DisplaySubtypeFeatureLayerDisplays a composite layer of all the subtype values in a feature class.
DisplayUtilityAssociationsCreate graphics for utility associations in a utility network.
DisplayWfsDisplay a layer from a WFS service, requesting only features for the current extent.
DistanceMeasurementMeasure distances between two points in 3D.
EditAndSyncFeaturesSynchronize offline edits with a feature service.
EditBranchVersioningCreate, query and edit a specific server version using service geodatabase.
EditFeatureAttachmentsAdd, delete, and download attachments for features from a service.
EditFeatureLinkedAnnotationEdit feature attributes which are linked to annotation through an expression.
EditKmlGroundOverlayEdit the values of a KML ground overlay.
FeatureCollectionLayerFromPortalCreate a feature collection layer from a portal item.
FeatureCollectionLayerFromQueryCreate a feature collection layer to show a query result from a service feature table.
FeatureLayerDefinitionExpressionLimit the features displayed on a map with a definition expression.
FeatureLayerDictionaryRendererConvert features into graphics to show them with mil2525d symbols.
FeatureLayerExtrusionExtrude features based on their attributes.
FeatureLayerGeodatabaseDisplay features from a local geodatabase.
FeatureLayerGeoPackageDisplay features from a local GeoPackage.
FeatureLayerQueryFind features in a feature table which match an SQL query.
FeatureLayerRenderingModeMapRender features statically or dynamically by setting the feature layer rendering mode.
FeatureLayerRenderingModeSceneRender features in a scene statically or dynamically by setting the feature layer rendering mode.
FeatureLayerSelectionSelect features in a feature layer.
FeatureLayerShapefileOpen a shapefile stored on the device and display it as a feature layer with default symbology.
FeatureLayerTimeOffsetDisplay a time-enabled feature layer with a time offset.
FeatureLayerUrlShow features from an online feature service.
FindServiceAreasForMultipleFacilitiesFind the service areas of several facilities from a feature service.
GenerateGeodatabaseGenerate a local geodatabase from an online feature service.
GenerateOfflineMapWithOverridesTake a web map offline with additional options for each layer.
GeodatabaseTransactionsUse transactions to manage how changes are committed to a geodatabase.
GroupLayersGroup a collection of layers together and toggle their visibility as a group.
IdentifyKmlFeaturesShow a callout with formatted content for a KML feature.
IdentifyLayersIdentify features in all layers in a map. MapView supports identifying features across multiple layers. Because some layer types have sublayers, the sample recursively counts results for sublayers within each layer.
IdentifyRasterCellGet the cell value of a local raster at the tapped location and display the result in a callout.
LineOfSightGeoElementShow a line of sight between two moving objects.
ListKmlContentsList the contents of a KML file.
ListRelatedFeaturesList features related to the selected feature.
LocalServerFeatureLayerStart a local feature service and display its features in a map.
LocalServerGeoprocessingCreate contour lines from local raster data using a local geoprocessing package `.gpk` and the contour geoprocessing tool.
LocalServerMapImageLayerStart the Local Server and Local Map Service, create an ArcGIS Map Image Layer from the Local Map Service, and add it to a map.
ManageOperationalLayersAdd, remove, and reorder operational layers in a map.
MapImageLayerTablesFind features in a spatial table related to features in a non-spatial table.
MapImageSublayerQueryFind features in a sublayer based on attributes and location.
PerformValveIsolationTraceRun a filtered trace to locate operable features that will isolate an area from the flow of network resources.
PlayKmlToursPlay tours in KML files.
QueryFeatureCountAndExtentZoom to features matching a query and count the features in the current visible extent.
RasterColormapRendererApply a colormap renderer to a raster.
RasterHillshadeUse a hillshade renderer on a raster.
RasterLayerFileCreate and use a raster layer made from a local raster file.
RasterLayerGeoPackageDisplay a raster contained in a GeoPackage.
RasterLayerImageServiceRasterCreate a raster layer from a raster image service.
RasterLayerRasterFunctionLoad a raster from a service, then apply a function to it.
RasterRenderingRuleDisplay a raster on a map and apply different rendering rules to that raster.
RasterRgbRendererApply an RGB renderer to a raster layer to enhance feature visibility.
ReadGeoPackageAdd rasters and feature tables from a GeoPackage to a map.
ReadShapefileMetadataRead a shapefile and display its metadata.
RenderUniqueValuesRender features in a layer using a distinct symbol for each unique attribute value.
SceneLayerSelectionIdentify features in a scene to select.
SceneLayerUrlDisplay an ArcGIS scene layer from a URL.
SelectEncFeaturesSelect features in an ENC layer.
ServiceFeatureTableCacheDisplay a feature layer from a service using the **on interaction cache** feature request mode.
ServiceFeatureTableManualCacheDisplay a feature layer from a service using the **manual cache** feature request mode.
ServiceFeatureTableNoCacheDisplay a feature layer from a service using the **no cache** feature request mode.
SetMapSpatialReferenceSpecify a map's spatial reference.
ShowLabelsOnLayerDisplay custom labels on a feature layer.
ShowPopupShow predefined popups from a web map.
StatisticalQueryQuery a table to get aggregated statistics back for a specific field.
StyleWmsLayerChange the style of a Web Map Service (WMS) layer.
SurfacePlacementsPosition graphics relative to a surface using different surface placement modes.
SymbolizeShapefileDisplay a shapefile with custom symbology.
TimeBasedQueryQuery data using a time extent.
TraceUtilityNetworkDiscover connected features in a utility network using connected, subnetwork, upstream, and downstream traces.
UpdateAttributesUpdate feature attributes in an online feature service.
UpdateGeometriesUpdate a feature's location in an online feature service.
ViewPointCloudDataOfflineDisplay local 3D point cloud data.
ViewshedCameraAnalyze the viewshed for a camera. A viewshed shows the visible and obstructed areas from an observer's vantage point.
ViewshedGeoElementAnalyze the viewshed for an object (GeoElement) in a scene.
ViewshedLocationPerform a viewshed analysis from a defined vantage point.
WfsXmlQueryLoad a WFS feature table using an XML query.
WmsIdentifyIdentify features in a WMS layer and display the associated popup content.
WMSLayerUrlDisplay a WMS layer using a WMS service URL.
WmsServiceCatalogConnect to a WMS service and show the available layers and sublayers.
WMTSLayerDisplay a layer from a Web Map Tile Service.