mflawton

Trouble Projecting Extent in 3.0 API

Discussion created by mflawton on Jul 26, 2012
I am trying to update my extent reproject function from 2.8 to 3.0, but I keep getting an undefined variable error (newExtent). The variable inputExtent is valid. I even added the Spatial Reference for good measure. I have the outSR in the params variable. I'm not sure why the callback isn't populating the outputExtent variable. Ideas?

  function updateExtentStatePlaneNevadaWest(updatedExtent) {
   var inputExtent = new esri.geometry.Extent(updatedExtent.xmin,updatedExtent.ymin,updatedExtent.xmax,updatedExtent.ymax, new esri.SpatialReference({ wkid: 102113} ));
   var params = new esri.tasks.ProjectParameters();
   params.geometries = [inputExtent];
   params.outSR = new esri.SpatialReference({ wkid: 102709});
   geometryService.project(params, function(outputExtent) {
    newExtent = outputExtent[0]; //<-- comes out as undefined
    //after reprojected, connect to listen to mouse move and drag events
    var onMouseMoveHandler = dojo.connect(map, "onMouseMove", showCoordinates);
    var onMouseDragHandler = dojo.connect(map, "onMouseDrag", showCoordinates);
   });
  }

Outcomes