AnsweredAssumed Answered

Project extent driving me insane

Question asked by mflawton on Mar 4, 2013
Latest reply on Feb 16, 2017 by PuckettD
I used to have a nifty coordinate display handler that worked just fine in pre-3.0. It looked like this:

function updateExtentStatePlaneNevadaWest(updatedExtent) {
 geometryService.project([updatedExtent], new esri.SpatialReference({ wkid: 102709}), function(featVar) {
  newExtent = featVar[0]; 
  //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);
 });
}


Now I am trying to catch up with the crowd and get my applications on JSAPI version 3.2. This simple extent project is causing me a major headache. Below was my first attempt, but the "outputExtent" variable just wouldn't get populated:

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);
 });
}


In trying to debug this thing, I have broken down the variables and put the callback into a separate function, but I still can't get it to trigger. I'll admit that I'm probably not deciphering the error message properly. I can get the error callback to trigger, but I can't see what it is telling me. Chrome just gives me this error:

GET http://services.arcgisonline.com/ArcGIS/rest/info?f=json undefined (undefined)


I know there has got to be something simple I am over-looking. Any guidance is much appreciated.

Outcomes