AnsweredAssumed Answered

Zoom to Feature extremely slow

Question asked by rborowski on Nov 28, 2012
Latest reply on Nov 28, 2012 by rborowski
Hi All,
I am using the following code snippet straight from the javascript API examples and it appears to be working. However, it takes up to 10 seconds to complete the redraw (map.setExtent) by which time the user has given up and assumes it did not work. The feature layer I am using has about 60,000 polygons in it. Any ideas on how I can make this work and speed things up? Perhaps a different method than below?

      function zoomRow(id){
        statesLayer.clearSelection();
        var query = new esri.tasks.Query();
        query.objectIds = [id];
        statesLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW,function(features){
          //zoom to the selected feature
          var stateExtent = features[0].geometry.getExtent().expand(5.0);
          map.setExtent(stateExtent);
        });
      }

Outcomes