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

1006
3
08-04-2017 08:09 AM
ReneeCammarere
Occasional Contributor

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

0 Kudos
3 Replies
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Hi Renee, you posted your question under 'ArcGIS Pro SDK', however, if you re-post your question in one of the ArcGIS Runtime SDK communities you will get better coverage.  i.e. https://community.esri.com/community/developers/native-app-developers/arcgis-runtime-sdk-for-net

ReneeCammarere
Occasional Contributor

When I clicked on the above link, it indicated . . . 

Not Found

The item does not exist. It may have been deleted.

I was not able to find the proper place to post this.  That's why I posted it here.

Thanks.

0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Strange, didn't work for me anymore either 🙂  Hope this link works: https://community.esri.com/community/developers/native-app-developers/arcgis-runtime-sdk-for-net

0 Kudos