Features to pass to jimu SelectionManager class

187
1
01-31-2020 03:36 AM
GianniContino
New Contributor III

I have a Web AppBuilder application, and I call a GeoProcessing Service to retrieve features to select.

Features come as follows (in a normal ESRI JSON).

{
      "features": [
            {
               "attributes": {
                     "OBJECTID": 1051,
                     "CODE": "IT9140005",
                     "TYPE": "B",
                     "Name": "Lake S. John",
                     "AREA": "79781684.173",
                     "PERIMETER": "86058.177",
                     "HECTARES": "7978.168",
                     "SHAPE.AREA": 0.008503497389955931,
                     "SHAPE.LEN": 0.952023279018308
            },
         "geometry": {
               "rings": [
                     [[18.580059000423375,41.79841200001471],

                     [18.59070999966758,41.824356000330056],
                     [18.627246000103696,41.815020999720275],
                     ...
                     ...
                     ...]]
            }
         }
      ]
}

Now I need to select them from a layer by SelectionManager class as follows.

                this.selectionManager = SelectionManager.getInstance();
                  this.selectionManager.setSelection(layerToSelect, myfeatures).then(() => {
                   /* do something */
                });

What should myfeatures be?

Passing the the features of before it returns strange errors (related to something missing in features, spatial Ref, etc).

Which is the correct way to pass retrieved features to SelectionManager class, in order to select them?

Why do I have to pass geometry too, if the OBJECTIDs might be enough?

Could be better select them from an array of OBJECTID?

Thanx in advance

Gianni

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Esteemed Contributor

Gianni,

   That function is expecting an array of Graphic objects and that the layer exists in the map already. So you need to use the Graphics class from json constructor .

https://developers.arcgis.com/javascript/3/jsapi/graphic-amd.html#graphic2 

0 Kudos