Stretch renderer

View on GitHub
Sample viewer app

Use a stretch renderer to enhance the visual contrast of raster data for analysis.

Default stretch renderer Edited stretch renderer

Use case

An appropriate stretch renderer can enhance the contrast of raster imagery, allowing the user to control how their data is displayed for efficient imagery analysis.

How to use the sample

Tap the toolbar button to change any of the following properties:

  • Stretch type - a histogram stretch that will be applied to the raster to enhance its appearance.
  • Min value - the minimum value on the histogram.
  • Max value - the maximum value on the histogram.

How it works

  1. Create an AGSRaster from a raster file.
  2. Create an AGSRasterLayer from the AGSRaster.
  3. Add the layer to the map.
  4. Create an AGSStretchRenderer, specifying the AGSStretchParameters and other properties.
  5. Apply the AGSStretchRenderer to the raster layer.

Relevant API

  • AGSColorRamp
  • AGSMinMaxStretchParameters
  • AGSPercentClipStretchParameters
  • AGSRaster
  • AGSRasterLayer
  • AGSStandardDeviationStretchParameters
  • AGSStretchParameters
  • AGSStretchRenderer

Offline data

This sample uses a raster file. It is downloaded from ArcGIS Online automatically.

About the data

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

Additional information

See Stretch function in the ArcMap documentation for more information about the types of stretches that can be performed.

Tags

analysis, deviation, histogram, imagery, interpretation, min-max, percent clip, pixel, raster, stretch, symbology, visualization

Sample Code

StretchRendererInputCell.swiftStretchRendererSettingsViewController.swiftStretchRendererViewController.swift
                    
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//
// Copyright 2016 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.

import UIKit

class StretchRendererInputCell: UITableViewCell {
    @IBOutlet var textField: UITextField!
}

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