pthorsel

Zoom to Selected Polygon

Discussion created by pthorsel on Sep 19, 2013
Latest reply on Sep 20, 2013 by zj_zou
My code will select and highlight the parcel that is clicked on, but it zooms in to the same spot on the map no matter which parcel I click on. It returns the correct parcel #, and there is only 1 record selected, but it keeps zooming to exact same spot. Any ideas?

for (var i = 0, il = results.features.length; i < il; i++) {

                var graphic = results.features[i];
                graphic.setSymbol(symbol);
                map.graphics.add(graphic);
                map.centerAndZoom(results.features[i].geometry, 0.1);
                
                alert(results.features.length); //this returns 1
 }

Outcomes