when querying directly on the layer i.e. not from the application geometry points are returned
function zoomToPst(item) { var id; var psname=item.value.toString(); var selectedTaxLot; // alert("acname" + acname); var queryTask1 = new esri.tasks.QueryTask ("http://mrsac.maharashtra.gov.in/ArcGIS/rest/services/MRSACServices/election/MapServer/0"); var symbol = new esri.symbol.PictureMarkerSymbol({ "angle":0, "xoffset":0, "yoffset":10, "type":"esriPMS", "url":"http://static.arcgis.com/images/Symbols/Shapes/BluePin1LargeB.png", "contentType":"image/png", "width":24, "height":24 }); var query1 = new esri.tasks.Query(); query1.returnGeometry = true; query1.outFields = ["OBJECTID"]; query1.where = "District= 'Nagpur' and AC_Name='"+ddl1+"' and PopupInfo='"+psname+"' "; //alert("qry rdy"); alert(""+"District= 'Nagpur' and AC_Name='"+ddl1+"' and PopupInfo='"+psname+"' "); queryTask1.execute(query1,function(results) { var zone; var values = []; var testVals={}; //alert("in exe qry"); //Add option to display all zoning types to the ComboBox values.push({name:"ALL"}) //Loop through the QueryTask results and populate an array //with the unique values var features = results.features; dojo.forEach (features, function(feature) { id=feature.attributes.OBJECTID; }); alert("id"+id); dojo.forEach(map.graphics.graphics,function(graphic) { if(graphic.attributes) { alert("gid"+graphic.attributes.OBJECTID); if(graphic.attributes.OBJECTID === id) { selectedTaxLot = graphic; alert("slct"); return ; } } }); alert("sext"+selectedTaxLot.geometry.getExtent()) var taxLotExtent = selectedTaxLot.geometry.getExtent(); map.setExtent(taxLotExtent); }); }
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.