Select to view content in your preferred language

Zoom to Selected Polygon

4088
10
09-19-2013 01:27 PM
PatrickThorsell
Emerging Contributor
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;
                graphic.setSymbol(symbol);
                map.graphics.add(graphic);
                map.centerAndZoom(results.features.geometry, 0.1);
                
                alert(results.features.length); //this returns 1
 }
0 Kudos
10 Replies
JasonZou
Frequent Contributor
I guessed it might be the projection issue, but thought setExtent will take care of the reprojection if the spatial reference is different. Anyway, glad to know you get it resolved. Please mark your thread as "Answered" so other people may find it helpful because I believe the issue you experienced is very typical. Thanks.
0 Kudos