var firstGraphic = null; // +++++Listen for QueryTask onComplete event+++++ dojo.connect(queryTask, "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); firstGraphic.setInfoTemplate(infoTemplate); map.graphics.add(firstGraphic); query.geometry = firstGraphic.geometry; query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_TOUCHES; queryTaskTouches.execute(query); dojo.byId('messages').innerHTML = "<b>Executing Polygon Touches Query...</b>";
Solved! Go to Solution.
I would like to allow users to search for a polygon location from one layer, and use a second query to determine if a different layer intersects the graphic returned by that first query.
Does the code below add the first query's graphic to the map then call the second query?
function queryFunction() { county = document.getElementById("countyField").value; taxDistrict = document.getElementById("taxDistrict").value; //streams = document.getElementById("streamField").value; var queryStreamsTask = new esri.tasks.QueryTask("link"); var queryTaxDistrictsTask = new esri.tasks.QueryTask("link"); var queryTaxDistricts = new esri.tasks.Query(); queryTaxDistricts.returnGeometry = true; queryTaxDistricts.outFields = ["DNAME", "CNAME"]; queryTaxDistricts.where = "CNAME = '" + county + "' and DNAME = '" + taxDistrict + "'"; queryTaxDistrictsTask.execute(queryTaxDistricts);