AnsweredAssumed Answered

Applying Heatmap Renderer to ArcGisDynamicMapServiceLayer

Question asked by danieljgalati on Apr 24, 2015
Latest reply on Dec 11, 2015 by gokuSan

Hello there,

 

I am attempting to apply a HeatMap renderer to a dynamic layer I have created. The DynamicLayer contains a point query gathered from my ArcGIS Server SDE database.

 

I have successfully implemented basic things such as SimpleRenderer to display the data on my map. However, whenever I attempt to use the same logic, but swap out the SimpleRenderer with HeatMapRenderer, I get errors. I am sure I am setting all parameters correctly as described in the Documentation Samples.

 

I am getting the following error reply from my ArcGIS Server: ":"Invalid renderer specified for dynamic dataLayer with 'id': 0."

 

My code is below: any help would be appreciated.

 

var dndSource, layerLookup, dynamicLayerInfos;

 

 

                (function() {

                    var layerName, dataSource, layerSource, options, drawingOptions;

                    debugger;

 

 

                    ///Testing Renderer

 

 

                    var heatmapRenderer = new HeatmapRenderer({

                        blurRadius: 10,

                        colorStops: [

                            { ratio: 0, color: "rgba(250, 0, 0, 0)" },

                            { ratio: 0.6, color: "rgb(250, 0, 0)" },

                            { ratio: 0.85, color: "rgb(250, 150, 0)" },

                            { ratio: 0.95, color: "rgb(255, 255, 0)" }],

                    });

                    var m_renderer = heatmapRenderer;

                    var m_queryDataSource = new QueryDataSource();

                    m_queryDataSource.workspaceId = biodWeb.const.gis.workSpaceID;

                    m_queryDataSource.geometryType = "point";

                    m_queryDataSource.oidFields = ["OBJECTID"];

                    m_queryDataSource.query = "Select OBJECTID, Shape from bioDWEB.BD.NATEARTH_10M_POPULATED_PLACES";

                    m_queryDataSource.spatialReference = new SpatialReference({ wkid: 102100 });

                    m_queryDataSource.workspaceId = biodWeb.const.gis.workSpaceID;

                    var layerSource = new LayerDataSource();

                    layerSource.dataSource = m_queryDataSource;

                   

                    //---------- Dynamic layer

                    layerName = "add a new layer from database";

                    var usaLayer = new ArcGISDynamicMapServiceLayer("http://MYSERVER.COM/arcgis/rest/services/BiodWebDyn/BioD_DynamicMap/MapServer",

                    { "id": "NEW LAYER" });

                    usaLayer.setVisibleLayers([0]);

                    if (!dynamicLayerInfos) {

                        dynamicLayerInfos = usaLayer.createDynamicLayerInfosFromLayerInfos();

                    }

                    var dynamicLayerInfo = new DynamicLayerInfo();

                    dynamicLayerInfo.id = 0;

                    dynamicLayerInfo.name = layerName;

                    dynamicLayerInfo.source = layerSource;

                    dynamicLayerInfos.push(dynamicLayerInfo);

                    usaLayer.setDynamicLayerInfos(dynamicLayerInfos, true);

 

 

                    drawingOptions = new LayerDrawingOptions();

                    drawingOptions.renderer = m_renderer;

                    options = [];

                    options[0] = drawingOptions;

                    usaLayer.setLayerDrawingOptions(options);

 

 

                    map.addLayer(usaLayer);

 

 

                })();

Outcomes