Click or drag to resize

RasterLayer Class

An instance of this class allows you to display raster data (from a raster data source).
Inheritance Hierarchy

Namespace:  Esri.ArcGISRuntime.Mapping
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.7.0.0
Syntax
C#
public sealed class RasterLayer : ImageAdjustmentLayer, 
	IPopupSource, ITimeAware

The RasterLayer type exposes the following members.

Constructors
  NameDescription
Public methodRasterLayer(String)
Initializes a new instance of the RasterLayer class.
Public methodRasterLayer(Item)
Initializes a new instance of the RasterLayer class with the given image service portal item.
Public methodCode exampleRasterLayer(Raster)
Initializes a new instance of the RasterLayer class from a raster.
Top
Properties
  NameDescription
Public propertyAttribution
Gets the attribution text for the layer.
(Inherited from Layer.)
Public propertyBrightness
Gets or sets layer brightness level.
(Inherited from ImageAdjustmentLayer.)
Public propertyCanChangeVisibility
Gets a value indicating whether the layer content's visibility can be changed.
(Inherited from Layer.)
Public propertyContrast
Gets or sets layer contrast level.
(Inherited from ImageAdjustmentLayer.)
Public propertyDescription
Gets the description for the layer.
(Inherited from Layer.)
Public propertyCode exampleFullExtent
Gets the full extent of the layer, which is the extent where all the data in the layer is contained.
(Inherited from Layer.)
Public propertyFullTimeExtent
Gets the temporal window that encapsulates the instance's complete set of data
Public propertyGamma
Gets or sets layer gamma level.
(Inherited from ImageAdjustmentLayer.)
Public propertyCode exampleId
Gets or sets an identifier for the layer
(Inherited from Layer.)
Public propertyIsIdentifyEnabled
Gets a value indicating whether the layer supports the identify operation.
(Inherited from Layer.)
Public propertyIsPopupEnabled
Gets or sets a value indicating whether the PopupDefinition defined on the RasterLayer is enabled.
Public propertyIsTimeFilteringEnabled
Gets or sets whether the instance respects any temporal filters that are applied to it
Public propertyCode exampleIsVisible
Gets or sets a value indicating whether the layer content is visible.
(Inherited from Layer.)
Public propertyItem
Gets the ArcGIS Item
(Inherited from Layer.)
Public propertyLoadError
Gets the load error of the layer, if there is one.
(Inherited from Layer.)
Public propertyCode exampleLoadStatus
Gets the load status of the layer.
(Inherited from Layer.)
Public propertyCode exampleMaxScale
Gets or sets the maximum scale where the layer is visible.
(Inherited from Layer.)
Public propertyCode exampleMinScale
Gets or sets the minimum scale where the layer is visible.
(Inherited from Layer.)
Public propertyCode exampleName
Gets or sets the name of the layer content.
(Inherited from Layer.)
Public propertyCode exampleOpacity
Gets or sets the opacity of the layer.
(Inherited from Layer.)
Public propertyPopupDefinition
Gets or sets the pop-up definition for the RasterLayer.
Public propertyRaster
Gets or sets the raster object on the layer.
Public propertyCode exampleRenderer
Gets or sets the raster renderer used for rendering the raster on this layer.
Public propertyShowInLegend
Gets or sets a value indicating whether the layer content participates in the legend.
(Inherited from Layer.)
Public propertySpatialReference
Gets the spatial reference of the layer.
(Inherited from Layer.)
Public propertyCode exampleSublayerContents
Gets the sub layer contents of a layer content.
(Inherited from Layer.)
Public propertySupportsTimeFiltering
Gets whether the instance supports filtering its data based on time
Public propertyTimeInterval
Gets a temporal value that represents the suggested temporal interval to use when sequentially stepping through the instance's data by time
Public propertyTimeOffset
Gets or sets the amount of time by which to offset the temporal values of data points in this instance when displaying the data in a GeoView
Top
Methods
  NameDescription
Public methodCancelLoad
Cancels an ongoing load.
(Inherited from Layer.)
Public methodCode exampleClone
Clones this instance of Layer and its members.
(Inherited from Layer.)
Public methodGetLegendInfosAsync
Returns an immutable list of LegendInfo.
(Inherited from Layer.)
Public methodIsVisibleAtScale
Returns the layer content's effective visibility at the specified scale.
(Inherited from Layer.)
Public methodCode exampleLoadAsync
Initiates loading of a layer
(Inherited from Layer.)
Public methodRetryLoadAsync
Retry loading the layer.
(Inherited from Layer.)
Top
Events
  NameDescription
Public eventFullTimeExtentChanged
Raised when the FullTimeExtent of the instance's data changes
Public eventCode exampleLoaded
Occurs when the layer is loaded.
(Inherited from Layer.)
Public eventCode exampleLoadStatusChanged
Occurs when the layer LoadStatus is changed.
(Inherited from Layer.)
Public eventPropertyChanged
Occurs when a property value changes.
(Inherited from Layer.)
Top
Examples

Android

Example Name: RasterLayerImageServiceRaster

Create a raster layer from a raster image service.

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 Android.App;
using Android.OS;
using Android.Widget;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Rasters;
using Esri.ArcGISRuntime.UI.Controls;
using System;

namespace ArcGISRuntime.Samples.RasterLayerImageServiceRaster
{
    [Activity (ConfigurationChanges=Android.Content.PM.ConfigChanges.Orientation | Android.Content.PM.ConfigChanges.ScreenSize)]
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        "ArcGIS raster layer (service)",
        "Layers",
        "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;

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Title = "ArcGIS raster layer (service)";

            CreateLayout();
            Initialize();
        }

        private 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 myUri = new Uri("https://gis.ngdc.noaa.gov/arcgis/rest/services/bag_hillshades/ImageServer");

            // Create new image service raster from the Uri.
            ImageServiceRaster myImageServiceRaster = new ImageServiceRaster(myUri);

            // Create a new raster layer from the image service raster.
            RasterLayer myRasterLayer = new RasterLayer(myImageServiceRaster);

            // Add the raster layer to the maps layer collection.
            myMap.Basemap.BaseLayers.Add(myRasterLayer);

            // Assign the map to the map view.
            _myMapView.Map = myMap;

            // zoom in to the San Francisco Bay.
            _myMapView.SetViewpointCenterAsync(new MapPoint(-13643095.660131, 4550009.846004, SpatialReferences.WebMercator), 100000);
        }

        private void CreateLayout()
        {
            // Create a new vertical layout for the app.
            LinearLayout layout = new LinearLayout(this) { Orientation = Orientation.Vertical };

            // Add the map view to the layout.
            _myMapView = new MapView(this);
            layout.AddView(_myMapView);

            // Show the layout in the app.
            SetContentView(layout);
        }
    }
}
Examples

Xamarin Forms Android

Example Name: RasterLayerImageServiceRaster

Create a raster layer from a raster image service.

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 Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Rasters;
using System;
using Xamarin.Forms;

namespace ArcGISRuntime.Samples.RasterLayerImageServiceRaster
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        "ArcGIS raster layer (service)",
        "Layers",
        "Add a raster layer from an image service to a map.",
        "")]
    public partial class RasterLayerImageServiceRaster : ContentPage
    {
        public RasterLayerImageServiceRaster()
        {
            InitializeComponent ();

            Initialize();
        }

        private 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. (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.
            ImageServiceRaster myImageServiceRaster = new ImageServiceRaster(myUri);

            // Create a new raster layer from the image service raster.
            RasterLayer myRasterLayer = new RasterLayer(myImageServiceRaster);

            // Add the raster layer to the maps layer collection.
            myMap.Basemap.BaseLayers.Add(myRasterLayer);

            // Assign the map to the map view.
            MyMapView.Map = myMap;

            // zoom in to the San Francisco Bay.
            MyMapView.SetViewpointCenterAsync(new MapPoint(-13643095.660131, 4550009.846004, SpatialReferences.WebMercator), 100000);
        }
    }
}
XAML
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"             
             xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
             xmlns:mapping="clr-namespace:Esri.ArcGISRuntime.Mapping;assembly=Esri.ArcGISRuntime" 
             x:Class="ArcGISRuntime.Samples.RasterLayerImageServiceRaster.RasterLayerImageServiceRaster">
  <Grid>
    <esriUI:MapView x:Name="MyMapView"/>
  </Grid>
</ContentPage>
See Also
Additional Examples
Hyperlink to ExampleDescription
ChangeBlendRendererBlend a hillshade with a raster by specifying the elevation data. The resulting raster looks similar to the original raster, but with some terrain shading, giving it a textured look.
ChangeStretchRendererUse a stretch renderer to enhance the visual contrast of raster data for analysis.
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.
RasterLayerGeoPackageOpen a `GeoPackage`, obtain a raster from the package, and display the table as a `RasterLayer`.
RasterLayerImageServiceRasterCreate a raster layer from a raster image service.
RasterLayerRasterFunctionShow a raster layer from an image service with a raster function applied.
RasterRenderingRuleDisplay a raster on a map and apply different rendering rules to that raster.
RasterRgbRendererUse an `RGBRenderer` on a `RasterLayer`. An `RGBRenderer` is used to adjust the color bands of a multispectral image.
ReadGeoPackageAdd rasters and feature tables from GeoPackages to a map.