lucbelliveau

Query for polygon and adjacent polygons

Discussion created by lucbelliveau on Aug 13, 2010
Latest reply on Aug 16, 2010 by lucbelliveau
I am trying to implement the sample titled "Query for polygon and adjacent polygons" from the resource center, but there seems to be something not right...

The first query runs successfully, and returns a feature which I can add as a graphic to the map... when I try and pass the geometry of the retrieved feature, it simply stops... no error messages, nothing. 

If I comment out the "query.geometry = firstGraphic.geometry;" line, it executes the second query (with invalid results of course)...

Any ideas what could be happening?

            var csdTask = new esri.tasks.QueryTask("http://foo/MapServer/107");
            var csdTask2 = new esri.tasks.QueryTask("http://foo/MapServer/107");

              var query = new esri.tasks.Query();
              query.returnGeometry = true;
              query.outFields = ["NAME"];

              dojo.connect(map, 'onClick', function(evt) {
                map.graphics.clear();
                map.infoWindow.hide();
                query.geometry = evt.mapPoint;
                query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_INTERSECTS;
                csdTask.execute(query);
              });

              var firstGraphic = null;
              dojo.connect(csdTask, 'onComplete', function(graphics) {
                  firstGraphic = graphics.features[0];
                  var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new dojo.Color([100,100,100]), 3), new dojo.Color([255,0,0,0.20]));
                  firstGraphic.setSymbol(symbol);
                  map.graphics.add(firstGraphic);

                  query.geometry = firstGraphic.geometry;
                  query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_TOUCHES;
                  console.log('one');
                  csdTask2.execute(query);
                  console.log('two');

              });

             dojo.connect(csdTask2, "onComplete", function(fset) {
               console.log('TEST');
              });

Outcomes