Spatial Query Geometry

Discussion created by jestanford on Nov 30, 2011
Latest reply on Dec 21, 2011 by pfreydiereesrifrance-fr-esridist
I'm attempting to perform a spatial query task using the geometry returned by a route task but it always fails and the only error I receive is "Deferred object is missing". The geometry appears to be valid, I can draw it on the map as a graphic.

The code below is the route task's solveComplete handler.

function showRoute(solveResult) {
        var routeGeo = solveResult.routeResults[0].route.geometry;
        routeGeo.spatialReference = new esri.SpatialReference({wkid:4326});

        var routeGraphic = new esri.Graphic(routeGeo, routeSymbol);;

        var routeExtent = routeGraphic.geometry.getExtent();
        routeExtent.spatialReference = new esri.SpatialReference({ wkid: 4326 });
        var queryTask = new esri.tasks.QueryTask("http://avalanche/ArcGIS/rest/services/Toll_Calc_Web/MapServer/4");
        var query = new esri.tasks.Query();
        query.outFields = ["*"];
        query.returnGeometry = true;
        query.outSpatialReference = { "wkid": 4326 };
        query.geometry = routeGeo;
        queryTask.execute(query, queryPlazasComplete, errorHandler);

If I swap out routeExtent (the extent of the route geometry) for routeGeo (the route geometry) as the geometry parameter of the query task is executes successfully.

I'm a javascript API newbie so any suggestions are appreciated!

Thank you!!