AnsweredAssumed Answered

Feature response from MapView.identifyLayer vs FeatureLayer.selectFeaturesWithQuery vs FeatureTable.queryFeatures

Question asked by jon.g@39dn.com on Nov 29, 2016
Latest reply on Dec 2, 2016 by jon.g@39dn.com

MapView.identifyLayer seems to work well, it fires off a single request and returns a Feature object which has all the feature's fields and attributes. That feature comes from an instance of FeatureTable that I never created directly and prior to this query had no reference to, so I'm a bit weary to trust it. 

 

FeatureLayer.selectFeaturesWithQuery is used in the feature attribute update example.  This sent me down a very confusing path as I didn't realize that waiting for the feature to "load" after you've already waited for the feature response was necessary.  I now see this in the example, but I was originally working from the documentation which doesn't say anything about this. Feature is a loadable, but it's not mentioned that while the feature object and its properties/methods are usable before loading, that the feature's attributes aren't all available until after loading.  The peculiar part about this is that it results in having to wait for two chained requests in order to accomplish what a single request would have accomplished, thus making a non-loadable version actually faster.

 

FeatureTable.queryFeatures seems to work the exact same as selectFeaturesWithQuery, only you obviously have to select the feature yourself if you want it selected. 

 

I noticed that I can actually just use MapView.identifyLayer's result as my feature object, even though it comes from an unknown FeatureTable. This results in only a single request being fired off, but literally the exact same response as doing the triple-request chain that occurs in the example. 

 

My questions:

 

  1. Where does MapView.identifyLayer get its FeatureTable instance? It's different than the one I created. 
  2. Can I update a feature in my own FeatureTable instance with the feature from MapView.identifyLayer? I've tried this and it seems to work for feature attributes, but I'm having difficulty with attachments.
  3. Is there a way to get a feature's full data in a single request AND be able to edit it? It seems unreasonable to require 3 or even 2 requests for the same data to accomplish this.

 

I confirmed this can be seen in the feature attribute update example if you monitor http requests.  The initial click triggers two requests, and hitting update triggers another. All 3 requests query for the same feature. 

 

 

Outcomes