Solved! Go to Solution.
Thanks for the insight Jeff. I do have scale dependencies set, but I should have mentioned that the map display is the whole point. The intention here is to do exactly what the ESRI States code sample does: Zoom in to a particular extent around the polygon (expand(5.0)) and highlight it on the map. Finding the extent of a queried polygon and then just resetting the map extent seemed to be the easiest way to do this. Maybe I am missing something here.
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);
});
}
Our parcel layer is 200k+. Anything other that a tiled service was unacceptable performance.
Just because you are querying a service does not mean you have to display it. In fact, it doesnt even need to be added to the map.
First thing i would do would be put big scale dependencies on display.
Thanks for the insight Jeff. I do have scale dependencies set, but I should have mentioned that the map display is the whole point. The intention here is to do exactly what the ESRI States code sample does: Zoom in to a particular extent around the polygon (expand(5.0)) and highlight it on the map. Finding the extent of a queried polygon and then just resetting the map extent seemed to be the easiest way to do this. Maybe I am missing something here.