Select to view content in your preferred language

Raster rendering with ArcGISDynamicMapServiceLayer

4613
3
06-27-2013 06:44 AM
JeremieJoalland1
Deactivated User
I using the ESRI sample "Add Raster" (in Datasources) to test the possibility to load DTED raster from local file.
It's working fine with *.dt0 files.

My issue is that the default rendering is Stretched and based on min/max values of the DTED tile cells (similar to the rendering I have when loading the same tile in ArcMap. same colorramp : Elevation #2). So from one tile to another, the min/max values are different, so rendering is not continue, as this image show it :

[ATTACH=CONFIG]25547[/ATTACH]

Is it possible to change the raster rendering  ?
In my case, I would like to change the classification with colorramp with same min/max values for all tiles.

It seems to me that DrawingInfo only apply to layers with features (shapefile, graphicsLayer, ...)... What can I do with raster ?
0 Kudos
3 Replies
CarlosColón-Maldonado
Frequent Contributor
Have you looked into the Datasources->Image Services->Rendering Rule sample? It uses a RasterFunction class used to set a rendering rule on the image service.

                    RasterFunction renderingRule = new RasterFunction(); 
                    renderingRule.setFunctionName(selectedFunction); 
 
                    if ("ShadedRelief".equals(selectedFunction)) { 
                        // ShadedRelief 
                        renderingRule.setVariableName("Raster"); 
                        Map<String, Object> mapArguments = new HashMap<String, Object>(); 
                        mapArguments.put("Azimuth", 215); 
                        mapArguments.put("Altitude", 60.0); 
                        mapArguments.put("ZFactor", 4); 
                        mapArguments.put("Colormap", createColorMap()); 
                        renderingRule.setArgumentsAsMap(mapArguments); 
                    } else if ("Hillshade".equals(selectedFunction)) { 
                        // Hillshade 
                        renderingRule.setVariableName("DEM"); 
                        Map<String, Object> mapArguments = new HashMap<String, Object>(); 
                        mapArguments.put("Azimuth", 215); 
                        mapArguments.put("Altitude", 60.0); 
                        mapArguments.put("ZFactor", 4); 
                        renderingRule.setArgumentsAsMap(mapArguments); 
                    } else { 
                        // selected function is "Slope" 
                        renderingRule.setVariableName("DEM"); 
                        Map<String, Object> mapArguments = new HashMap<String, Object>(); 
                        mapArguments.put("ZFactor", 4); 
                        renderingRule.setArgumentsAsMap(mapArguments); 
                    } 
 
                    imageServiceLayer.setRenderingRule(renderingRule); 
                    imageServiceLayer.refresh();
0 Kudos
JeremieJoalland1
Deactivated User
The problem is that I don't see how I can manage to use ArcGISImageServiceLayer, because I need to add dynamicaly several DTED raster files, but this class doesn't have getDynamicLayerInfos() function (as in sample Add Raster)

the sample is surely working fine with online image service, but once again I'm in disconnected scenario with only local files... I don't want to prepare a Map Package with my raster, I need to load them dynamicaly... do you think it's possible with ArcGISImageServiceLayer ?
0 Kudos
JeremieJoalland1
Deactivated User
The best solution for this issue would be to be able to use geoprocessing on DTED raster "Set Raster Properties", in order to define new Min/Max statistics for each raster tile, but it's unsupported by ArcGIS Runtime at this time.

However, as I needed at least a temporary solution, I was able to compute general statistics on several DTED in order to look at min/max/average/stand dev. values. In fact the "Set Raster Properties" generates 2 xml files for each DTED with lot of informatons, but what I was looking is pretty simple :

<PAMDataset>
  <PAMRasterBand band="1">
    <Metadata>
      <MDI key="STATISTICS_MINIMUM">0</MDI>
      <MDI key="STATISTICS_MAXIMUM">8850</MDI>
      <MDI key="STATISTICS_MEAN">500</MDI>
      <MDI key="STATISTICS_STDDEV">600</MDI>
    </Metadata>
  </PAMRasterBand>
</PAMDataset>


So now I'm using an xml template with this few lines, and prior to load dynamicaly my DTED, I copy this template file for each DTED (.dt0, .dt1 or .dt2) with the extension .aux.xml. (n40.dt0 -> n40.dt0.aux.xml)

This little trick is working fine and ArcGIS Runtime can apply homogenuous rendering for all loaded DTED tiles ! (of course, these statistics values should be calculated dynamicaly... but no geoprocessing tool is supported to do that at this time)

[ATTACH=CONFIG]26875[/ATTACH]
0 Kudos