Select to view content in your preferred language

How to create an elevation heatmap in my WPF application

189
3
Jump to solution
4 weeks ago
Labels (3)
AndreyTsar
Emerging Contributor

I want to create an elevation heatmap for the current view. Where should I start? Is there an example available?

0 Kudos
1 Solution

Accepted Solutions
dotMorten_esri
Esri Notable Contributor

If you have your elevation data as a raster image, you could use a Raster layer with a RasterRenderer applied that maps elevation to a color ramp.

View solution in original post

3 Replies
dotMorten_esri
Esri Notable Contributor

If you have your elevation data as a raster image, you could use a Raster layer with a RasterRenderer applied that maps elevation to a color ramp.

AndreyTsar
Emerging Contributor

Thank you very much for your response! It turned out something like this:

string rasterPath = @"D:\srtm_44_02.tif";

Raster rasterElevation = new Raster(rasterPath);
RasterLayer rasterLayerForDisplayInMap = new RasterLayer(rasterElevation);
rasterLayerForDisplayInMap.Opacity = 0.65;

ColorRamp myColorRamp = ColorRamp.Create(PresetColorRampType.Elevation);

await rasterLayerForDisplayInMap.LoadAsync();
await rasterElevation.LoadAsync();

StretchRenderer stretchRenderer = new StretchRenderer(new MinMaxStretchParameters(new List<double> { 120 }, new List<double> { 400 }), new List<double>() { 0.75 }, true, myColorRamp);

rasterLayerForDisplayInMap.Renderer = stretchRenderer;
mapView.Map.OperationalLayers.Clear();
mapView.Map.OperationalLayers.Add(rasterLayerForDisplayInMap);

0 Kudos
AndreyTsar
Emerging Contributor

But I encountered two more problems:

  1. If the size of my GED or SRTM files is within 5 degrees (up to 25 MB), the raster loads without any issues. However, if I try to load larger data within 30 degrees (from 500 MB), an error occurs during loading.

  2. I couldn't figure out how to get the minimum and maximum elevation values from the file.

I would appreciate it if you could help me with these issues.

0 Kudos