AnsweredAssumed Answered

Select only features within a drawn polygon

Question asked by rhyck.m on Mar 30, 2016
Latest reply on Mar 30, 2016 by rhyck.m

I am using query task to select only features within a drawn polygon.

    executeRequestByShape: function () {
                var deffByShape = new Deferred();
                var queryTask = new QueryTask(this.layerUrl);
                var query = new Query();
                query.returnGeometry = true;
                query.geometry = this.geometry;
                query.spatialRelationShip = Query.SPATIAL_REL_WITHIN;
                query.outFields = ["*"];
                var queryResults = queryTask.execute(query);
                var promiseResult = all([queryResults])
                          .then(function (r) {
                              deffByShape.resolve(r);
                          })
                return deffByShape.promise;
            }

 

 

 

but this code is returning features that intersect the drawn polygon. Any idea?

Outcomes