Good day
If I have a view with 200 features in it, but only 150 features are shown because 50 of them are too small, after setting a definition expression, is there a method to select them all, even the non-visible ones, using the Sketch Widget "Draw a Rectangle" tool?
My current logic is:
Processng the "Draw"
this._sketchWidget.on("create", async (event) => {
if (event.state === "complete") {
this._view.graphics.removeAll();
const geometries = this.sketchLayer.graphics.map((graphic) => {
return graphic.geometry
});
const queryGeometry = await geometryEngineAsync.union(geometries.toArray());
this.selectFeatures(queryGeometry);
}
});
Running the query:
private selectFeatures(geometry): void {
const query = {
geometry: geometry,
outFields: ["*"],
returnGeometry: true,
};
this._view.graphics.removeAll();
this.sketchLayer.graphics.removeAll();
this._view.map.layers.forEach((layer) => {
if (layer.type === 'feature') {
this._view.whenLayerView(layer).then((layerView) => {
layerView.queryFeatures(query).then((results: IQueryFeaturesResponse) => {
this.blah = [];
results.features.forEach((result) => {
this.blah.push(result.attributes.objectId);
const graphic = new Graphic(<GraphicProperties>result.geometry);
this._view.graphics.add(graphic);
})
}).catch((queryError) => {
console.log('Query Error');
console.log(queryError);
})
})
}
})
}
Is there a query parameter I can use to make sure everything, no matter its size, is selected?
Thanks