AnsweredAssumed Answered

Using ArcGIS Runtime, problems adding raster layer to Map.OperationalLayers

Question asked by reneecammarere on Aug 4, 2017
Latest reply on Aug 7, 2017 by wkaiser-esristaff

I'm having problems (not in every case, but when attempting to display some rasters on the map) with either none or some of the Elevation (DEM) Raster Layer not showing up on the map.  However, when I bring the raster into ArcMap, the image looks fine.  This only happens with the rasters that I assign the Elevation color ramp stretch renderer to.  It doesn't happen with rasters that I don't assign a renderer to (although I don't know if that has anything to do with it).

 

This is what my C# code looks like . . .

 

using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Rasters;

 . . . . . 

 

var newRaster = new Raster(rasterPath); // create the raster object from the image file
var newRasterLayer = new RasterLayer(newRaster); // create the raster layer object from the raster

double[] minVals = { min }; // minimum value for stretch parameters input
double[] maxVals = { max }; // maximum value for stretch parameters input
MinMaxStretchParameters minMaxParams = new MinMaxStretchParameters(minVals, maxVals); // create stretch parameters object
ColorRamp elevationColorRamp = ColorRamp.Create(PresetColorRampType.Elevation); // create the color ramp
var rendrr = new StretchRenderer(minMaxParams, null, true, elevationColorRamp); // create the renderer from the above
newRasterLayer.Renderer = rendrr; // apply the renderer to the raster layer
newRasterLayer.Opacity = 0.6; // set the opacity
var mapViewModel = ServiceLocator.Current.GetInstance<MapViewModel>(); // get the map view model
mapViewModel.Map.OperationalLayers.Add(newRasterLayer); // add the raster layer to the map

 

 

Have there been issues reported having to do with displaying DEM rasters on a map (perhaps relating to OperationalLayers object)?

 

Thanks,

Renee

Outcomes