Open jacobericson opened 5 years ago
https://developers.arcgis.com/javascript/3/jssamples/graphics_extent_query.html
Also it might be worth it to consider predefined rectangles in a feature layer for selection.
Moving to Sprint 2.
There is a built-in widget if you'd rather just use which works out-of-the-box:
https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch.html
You'd subscribe to the EsriMapService store and get the view
instance, and then add the widget class instance.
view.ui.add(sketch, "top-right");
The problem with that approach is that widgets are run within the esri view ui container context, which means your styling and positioning options are limited to predefined ui locations, or "manual" position which will result in a UI element freely-floating and potentially intersecting with other elements. Because we don't like the lack of flexibility when positioning widgets, we make components which typically extend or utilize the returned class instances or view models and that way we have full control on instantiation, positioning, styling, and other custom functionality.
In any case, once there is a drawn polygon on the map, you can get that polygon and run a Query
against a FeatureLayer
to limit features within a region.
As an employee
I want to be able to select a region.