AnsweredAssumed Answered

Finding features within area using geometryEngine

Question asked by Dschontzler_pulsiam on Dec 20, 2018
Latest reply on Dec 20, 2018 by Dschontzler_pulsiam



I am trying to locate features on my map within a given radius of a mouse click. I assumed geometryEngine would do the trick, but I am not able to make it work.


      CodePen sample: ArcGIS: Find features with geometryEngine.


When you click on the map, it creates a geodesicBuffer with a 200m radius from the map point and attempts to locate the number of map features within that area. But the console always logs 0 items found. Here is the particular code that does the searching:

     view.on('click', function (e) {
        var centerPt = e.mapPoint;
        if (e.native.ctrlKey) {
          // add more points to the map
        } else {
          // search in the clicked area for points
          var geom = geometryEngine.geodesicBuffer(centerPt, 200, 'meters');
          if (circleGraphic);
          circleGraphic = new Graphic({
            geometry: geom,
            symbol: {
              type: 'simple-fill',
              color: [140, 140, 222, 0.5]
          inPts = points.filter(item => {
            return geometryEngine.within(geom, item.geometry);
          console.log('This area contains', inPts.length, 'points');


I've tried geometryEngine.contains as well with no success. Any suggestions?