View on GitHub Sample viewer app

Apply a hillshade renderer to a raster.

Image of apply hillshade renderer to raster

Use case

To monitor coastal erosion, an environmental agency could analyze images of a specific area captured over a longer period of time while applying hillshade renderers for comparison.

How to use the sample

Choose and adjust the settings to update the hillshade renderer on the raster layer. The sample allows you to change the Altitude, Azimuth, and Slope Type.

How it works

  1. Create a Raster from a grayscale raster file.
  2. Create a RasterLayer from the raster.
  3. Create a Basemap from the raster layer and set it to the map.
  4. Create a HillshadeRenderer, specifying the slope type and other properties, HillshadeRenderer.create(...).
  5. Set the hillshade renderer to be used on the raster layer with RasterLayer.renderer.

Relevant API

  • Basemap
  • HillshadeRenderer
  • Raster
  • RasterLayer

Tags

altitude, angle, azimuth, raster, slope, visualization

Sample Code

DownloadActivity.kt DownloadActivity.kt MainActivity.kt ApplyHillshadeRendererToRasterViewModel.kt ApplyHillshadeRendererToRasterScreen.kt
/* Copyright 2025 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.
*
*/
package com.esri.arcgismaps.sample.applyhillshaderenderertoraster
import android.content.Intent
import android.os.Bundle
import com.esri.arcgismaps.sample.sampleslib.DownloaderActivity
class DownloadActivity : DownloaderActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
downloadAndStartSample(
Intent(this, MainActivity::class.java),
// get the app name of the sample
getString(R.string.apply_hillshade_renderer_to_raster_app_name),
listOf(
// Portal item which contains a zip of the SRTM raster image files
"https://www.arcgis.com/home/item.html?id=134d60f50e184e8fa56365f44e5ce3fb"
)
)
}
}