Hello,
I am trying to highlight a cluster by using the queryFeatures method on a GeoJSON layer, but only the children of the cluster are highlighted when I turn off the marker clustering.
I am using a Sketch widget to highlight only items in the selected area.
Can the clusters be highlighted instead of the children?
sketch.on("create", function(event) {
if (event.state === "complete") {
selectFeatures(event.graphic.geometry);
}
});
var highlight;
function selectFeatures(geometry){// remove the first sketch shape if it exists
if(sketchLayer.graphics.items.length > 1){var firstItem = sketchLayer.graphics.items[0];
sketchLayer.graphics.remove(firstItem);}
// remove the current highlight if set
if(highlight){highlight.remove();
}
// query
view.whenLayerView(layer).then(function(layerView){var query = layer.createQuery();
query.geometry = geometry;
query.returnGeometry = true;
layer.queryFeatures(query).then(function(result){highlight = layerView.highlight(result.features); // clusters are not highlighted here, only the children
});
});
}
Anybody?
I would love to know if that is possible too