Is there a way to get the extent of a query and not each individual feature?

المشرف العام

Administrator
طاقم الإدارة
I'm using this solution to get the extent of a query. It brings every feature geometry back to the client where I then calculate the extent of all the individual geometries. Since these can be polyline and polygon features this is a very expensive process. Is there a way to form the query so only the extent is returned?

app.filter.on("zoom-to-features", () => { console.log("set map extent to include all annotations matching this criteria"); all(common.GeoUtil .getFeatureLayers(app.map) .map(l => { var query = new EsriQuery(); query.returnGeometry = true; query.outFields = []; query.where = where; return l.queryFeatures(query); })).then(results => { var features = results; var extents = features.map(result => result.features .map(f => common.GeoUtil.getExtent(f.geometry)) .reduce((a, b) => a ? a.union(b) : b, null)); var extent = extents.reduce((a, b) => a ? b ? a.union(b) : a : b, null); extent && app.map.setExtent(extent); });});

أكثر...
 
أعلى