I want to create an elevation heatmap for the current view. Where should I start? Is there an example available?
Solved! Go to Solution.
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.
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.
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);
But I encountered two more problems:
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.
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.