AnsweredAssumed Answered

Feature Reduction not working for dynamic Feature Layer

Question asked by shaikhrizuan on Jan 2, 2018
Latest reply on Jan 5, 2018 by shaikhrizuan

Hi,

I am adding large amount of points as a dynamic feature layer, and try to cluster those point features by using the below code:

.............................................................................

.....

var jsonFS = new Object();
jsonFS.geometryType = "esriGeometryPoint";
jsonFS.features = features;
var featureSet = new FeatureSet(jsonFS);
var featureCollection = {
layerDefinition:
{
"displayFieldName": "",
"geometryType": "esriGeometryPoint",
"spatialReference": {
"latestWkid": 4326,
"wkid": 4326
},

"fields": [
{
"name": "objectid",
"type": "esriFieldTypeOID",
"alias": "objectid"
},
{
"name": "AGE",
"type": "esriFieldTypeString",
"alias": "AGE"
},
{
"name": "SEX",
"type": "esriFieldTypeString",
"alias": "SEX"
},
{
"name": "HS_NM",
"type": "esriFieldTypeString",
"alias": "HS_NM",
"length": 54
},
{
"name": "HS_NMBR",
"type": "esriFieldTypeString",
"alias": "HS_NMBR",
"length": 24
},
{
"name": "DED_PAN",
"type": "esriFieldTypeString",
"alias": "DED_PAN",
"length": 24
},
{
"name": "PAY_AMNT",
"type": "esriFieldTypeInteger",
"alias": "PAY_AMNT"
},
{
"name": "shape",
"type": "esriFieldTypeGeometry",
"alias": "shape"
}
],
},featureSet: featureSet};
var infoTemplate = new InfoTemplate("PAN : ${DED_PAN}", "AGE : ${AGE}<br>GENDER: ${SEX}<br>HOUSE NAME: ${HS_NM}<br>HOUSE NO.: ${HS_NMBR}<br>POI: ${POI}<br>PAYMENT AMOUNT: ${PAY_AMNT}<br>" );
this.dynamicFL=null;
//this.dynamicFL = new FeatureLayer(hsFeatureCollection, featureLayerOptions);
var featureLayerOptions ={
mode: FeatureLayer.MODE_SNAPSHOT,
outFields: ["*"],
infoTemplate: infoTemplate,
//featureReduction:{type="cluster"},
id: "Entity Map"
};
this.dynamicFL = new FeatureLayer(featureCollection,featureLayerOptions);
var extent = graphicsUtils.graphicsExtent(featureSet.features);
this.map.setExtent(extent.expand(1.2));

this.dynamicFL.enableFeatureReduction();

this.dynamicFL.setFeatureReduction({

 type:"cluster",

clusterRadius:20

});

 

I am getting this error : this.dynamicFL.enableFeatureReduction is not a function

Error

 

Do feature reduction supports for dynamic layer?? How can i achieve this??

Outcomes