var query = new Query(); query.geometry = pointToExtent(map, evt.mapPoint, 20);
Solved! Go to Solution.
map.on("click", function(e) { map.graphics.clear(); // create an extent var pad = map.extent.getWidth() / 10; var extent = new Extent( e.mapPoint.x - pad, e.mapPoint.y - pad, e.mapPoint.x + pad, e.mapPoint.y + pad, map.spatialReference ); // add the extent as a graphic map.graphics.add(new Graphic( extent, new SimpleFillSymbol().setColor(null).outline.setColor("#fff") )); var q = new Query(); q.geometry = extent; featureLayer.queryFeatures(q).then( function(result) { console.log("query result", result); }, function(error) { console.log("query error", error); } ); });
map.on("click", function(e) { map.graphics.clear(); // create an extent var pad = map.extent.getWidth() / 10; var extent = new Extent( e.mapPoint.x - pad, e.mapPoint.y - pad, e.mapPoint.x + pad, e.mapPoint.y + pad, map.spatialReference ); // add the extent as a graphic map.graphics.add(new Graphic( extent, new SimpleFillSymbol().setColor(null).outline.setColor("#fff") )); var q = new Query(); q.geometry = extent; featureLayer.queryFeatures(q).then( function(result) { console.log("query result", result); }, function(error) { console.log("query error", error); } ); });