elove

Zoom To Point??

Discussion created by elove on Dec 13, 2011
Latest reply on Dec 13, 2011 by elove
Hello,

I am working on a map that displays data in a dojo grid and when the user selects the row, it zooms to the feature on the map. There are points and polygons and the polygons are zoomed to correctly, however, the points are highlighting on the map, but not zooming in at all. Any help would be greatly appreciated!!:o

} else if (searchType == "PointName") { 
   var clickedTaxLotId = grid4.getItem(evt.rowIndex).POINT_NAME; 
   var selectedTaxLot; 
   dojo.forEach(map.graphics.graphics,function(graphic){ 
     if((graphic.attributes) && graphic.attributes.POINT_NAME === clickedTaxLotId){ 
    selectedTaxLot = graphic; 
    //added this part to build infotemplate
     map.infoWindow.setTitle(graphic.getTitle()); 
     map.infoWindow.setContent(graphic.getContent());
      //
    return; 
     } 
        }); 
  
   if ( selectedTaxLot.geometry.declaredClass == 'esri.geometry.Point' ) {
   //alert("Point");
   map.centerAt(selectedTaxLot.geometry);
   var sp = map.toScreen(selectedTaxLot.geometry);
   map.infoWindow.show(selectedTaxLot.geometry, map.getInfoWindowAnchor(sp));
   } else {
   //alert("Polygon");
   var taxLotExtent = selectedTaxLot.geometry.getExtent(); 
   var screenpoint = map.toScreen(selectedTaxLot.geometry.getExtent().getCenter());
   var mappoint = map.toMap(screenpoint);
    //map.centerAt(mappoint);
    //added by Emily
    map.centerAndZoom(selectedTaxLot.geometry,11);
   
   map.infoWindow.show(taxLotExtent.getCenter(), map.getInfoWindowAnchor(screenpoint));
   }
  }

Outcomes