TamuBikeShare / TamuBikeShareOptimization

JavaScript Monorepo containing all of Texas A&M's GeoInnovation Service Center libraries and modules for the official campus map, Aggiemap, and related applications utilizing the Aggiemap core.
MIT License
3 stars 1 forks source link

Region Selection #16

Open jacobericson opened 5 years ago

jacobericson commented 5 years ago

As an employee

I want to be able to select a region.

jacobericson commented 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.

jacobericson commented 5 years ago

Moving to Sprint 2.

Proantagonist commented 5 years ago

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.

https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html

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.