AnsweredAssumed Answered

How to display attribute values when clicking a point from a feature server?

Question asked by GISKschultz85 on Jul 13, 2018
Latest reply on Jul 16, 2018 by GISKschultz85

I want to click on a point to display attributes from a feature server.  The only tutorial/sample I could find was from App Studio v1.4  sample on github and too much has changed to get it working.

 

Currently my code looks like this

 

        onMouseClicked: {
            var tolerance = 22;
            var returnPopupsOnly = false;
            var maximumResults = 1;
            mapView.identifyLayerWithMaxResults(featureLayer, mouse.x, mouse.y, tolerance, returnPopupsOnly, maximumResults);
        }
        onIdentifyLayerStatusChanged: {
            if (identifyLayerStatus === Enums.TaskStatusCompleted) {
        
                featureLayer.clearSelection();
                var identifiedObjects = [];
                for (var i = 0; i < identifyLayerResult.geoElements.length; i++){
                    var elem = identifyLayerResult.geoElements[i];
                    identifiedObjects.push(elem);
                }
                var count = identifyLayerResult.geoElements.length;
                featureLayer.selectFeatures(identifiedObjects);
            }
        }

Which is just code I took from the selecting feature app sample.

I have this code

                        onSelectFeaturesStatusChanged: {
                
                            if (selectFeaturesStatus === Enums.TaskStatusCompleted) {
                                if (!selectFeaturesResult.iterator.hasNext)
                                    return;
                                selectedFeature = selectFeaturesResult.iterator.next();
                                value= selectedFeature.attributes.attributeValue("attributeValue");
                                console.log(value)
                            }


but it does not get invoked because selectFeatures apparently doesn't call
onSelectFeaturesStatusChanged? 





I find this all very frustrating, this should be extremely simple to do but there is no documentation that has been properly maintained
That even suggests how to properly accomplish this.

Outcomes