Load a raster from a service, then apply a function to it.
Use case
Raster functions allow processing operations that can be applied to one or more rasters on the fly. Functions can be applied to rasters that come from a service. A land survey agency may apply hillshade and aspect functions to rasters with elevation data in order to better determine the topography of a landscape and to make further planning decisions.
How to use the sample
The raster function is applied automatically when the sample starts and the result is displayed.
How it works
- Create the
ImageServiceRaster
referring to the image server URL. - Create the
RasterFunction
from a JSON string. - Get the name of the raster argument to the function with
rasterFunction.Arguments.GetRasterNames().First()
- Set the raster argument with
rasterFunction.SetRaster(rasterName, imageServiceRaster)
. - Create a new
Raster
referring to the raster function. - Create a
RasterLayer
to visualize the computed raster. - Display the raster.
Relevant API
- ImageServiceRaster
- Raster
- RasterFunction
- RasterFunctionArguments
- RasterLayer
About the data
The sample applies a hillshade function to a raster produced from the National Land Cover Database, NLCDLandCover2001. You can learn more about the hillshade function in the ArcMap documentation.
Additional information
The raster function computation happens locally on the client device.
Tags
function, layer, raster, raster function, service
Sample Code
<UserControl x:Class="ArcGISRuntime.WPF.Samples.RasterLayerRasterFunction.RasterLayerRasterFunction"
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>