Select to view content in your preferred language

Poor Raster Rendering with Small Values (v100.4)

597
0
07-16-2019 09:01 AM
KeithGemeinhart1
Regular Contributor

First, a general question about future versions of the runtime: Are there any plans to enhance the raster renderers or add a classify renderer? 

More generally, I'm doing some raster analysis and adding them to the map by creating a RasterLayer with the file path:

var rlayer = new RasterLayer(path);
rlayer.Id = id;
rlayer.Renderer = RendererFactory.GenerateRenderer(product, path);
rlayer.Opacity = 0.6;
rlayer.IsVisible = false;
layers.Add(rlayer);‍‍‍‍‍‍

RendererFactory is a class I wrote that chooses the renderer properties based on the type of file. The problem I'm running into is that even when I set the renderer properties to match the symbology in Pro, often times it doesn't render or has a very narrow range of colors. Anecdotally, this seems more likely to happen when the raster values are small (<1), or have a small range, or a small number of unique values. But I haven't really tried to narrow it down.

This is an example of one my rasters in Pro:

Here is it's corresponding symbology:

The same raster rendered on my map looks like this:

Here are the rendering parameters:

IEnumerable<double> myGammaValues = new List<double>() { 1.0 };

var std = new StandardDeviationStretchParameters(2.0);
var numColors = Math.Ceiling(max - min);
if (numColors < 16)
 numColors = 16;
ColorRamp myColorRamp = ColorRamp.Create(PresetColorRampType.Elevation, (uint)numColors);

var rendrr = new StretchRenderer(std, myGammaValues, true, myColorRamp);
return rendrr;

The result is the same if I change color ramp to DemScreen or if I use Min/Max parameters for the stretch renderer.

However, if I set the layer renderer to null, I actually get a better rendering (albeit grayscale):

Any advice on how to improve my raster rendering????

P.S. Sample raster attached.

0 Replies