I am able to query a feature layer using the following code

          var query = new Query();
          var geometry = null;
          query.returnGeometry = true;
          query.outFields = ["*"];
          query.where = "CONST LIKE '%"+searchString+"%'";
              var resultsArray = results.features;

However after collecting the results I would like to be highlighting the returned features on the mapView. The results however didn't return a 'graphics' attribute for me to add to the map layer which is why I am stuck.

How do I add features to the mapView using the returned features array?

1 Answer 1


I have a good example as an answer to my own question. Each feature in results.features should have its own geometry. If you know that it is a polygon geometry, you can instantiate a new polygon like so: new Polygon{rings:feature.geometry.rings}). This is a valid graphic to add to a graphics layer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.