Colormap renderer

View inMAUIUWPWPFWinUIView on GitHub

Apply a colormap renderer to a raster.

Image of colormap renderer

Use case

A colormap renderer transforms pixel values in a raster to display raster data based on specific colors, aiding in visual analysis of the data. For example, a forestry commission may want to quickly visualize areas above and below the tree-line line occurring at a know elevation on a raster containing elevation values. They could overlay a transparent colormap set to color those areas below the tree-line elevation green, and those above white.

How to use the sample

Pan and zoom to explore the effect of the colormap applied to the raster.

How it works

To apply a ColormapRenderer to a RasterLayer:

  1. Create a Raster from a raster file.
  2. Create a RasterLayer from the raster.
  3. Create an IEnumerable<Color> representing colors. Colors at the beginning of the list replace the darkest values in the raster and colors at the end of the list replaced the brightest values of the raster.
  4. Create a ColormapRenderer with the color list: ColormapRenderer(colors), and apply it to the raster layer with rasterLayer.Renderer = colormapRenderer.

Relevant API

  • Map
  • Basemap
  • ColormapRenderer
  • MapView
  • Raster
  • RasterLayer

Offline data

ShastaBW.tif raster

About the data

The raster used in this sample shows an area in the south of the Shasta-Trinity National Forest, California.

Tags

data, colormap, raster, renderer, visualization

Sample Code

RasterColormapRenderer.xamlRasterColormapRenderer.xamlRasterColormapRenderer.xaml.cs
1
2
3
4
5
6
7
8
9
10
<UserControl
    x:Class="ArcGIS.UWP.Samples.RasterColormapRenderer.RasterColormapRenderer"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:esri="using:Esri.ArcGISRuntime"
    xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
    <Grid>
        <esriUI:MapView x:Name="MyMapView" />
    </Grid>
</UserControl>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close