Generalization of Features and Search Widget

07-02-2021 09:09 AM
Occasional Contributor III

Does anyone understand the line below in the _onSelectResult method in the Widget.js file of the Search widget in Web AppBuilder?  I am trying to learn about graphics and generalization.  The first thing I wanted to understand is why the highlights in the Search widget are greatly simplified.  I have a 61 vertex pipeline that was simplified to 6 vertices and it is very jagged.  So, I am going through the code and trying to understand it.  As part of that process, I ran across this code as a possible clue.  I want to know why selectedFeature is simplified and resultFeature is not.  resultFeature appears to come from the on select result event.  selectedFeature comes from layer.queryFeatures.  I even tried to set maxAllowableOffset on featureQuery and I still got a simplified feature for selectedFeature.  


layer.queryFeatures(featureQuery, lang.hitch(this, function(featureSet) {
                var selectedFeature = null;
                if(featureSet && featureSet.features.length > 0) {
                  selectedFeature = featureSet.features[0];
                  // working around for js-api's generalization.
                  //   incorrect geometry of polygon result of queryFeatures.
                  selectedFeature.geometry = resultFeature.geometry;

                  this._loadInfoTemplateAndShowPopup(layerInfo, selectedFeature, e);
              }), lang.hitch(this, function() {
                // show popupInfo of searchResult.
                var selectedFeature = resultFeature;
                this._loadInfoTemplateAndShowPopup(layerInfo, selectedFeature, e);


Any help would be appreciated towards understanding the Esri developer's comment on generalization or why the Search widget highlights are generalized.

0 Kudos
0 Replies