;
Dear All,
Its a very urgent issue. I am not able get feature on querying on point and line feature. Featureset length will be 0.I am giving my code here.Please help me..
function createToolbar(map) {
// Create the ESRI drawing toolbar
toolbar = new esri.toolbars.Draw(map);
dojo.connect(toolbar, "onDrawEnd", runGeometryQuery);
}
var lyrind;
function runGeometryQuery(geometry)
{
var query = new esri.tasks.Query();
query.returnGeometry = true;
if (typeof (geometry) == "object")
{
query.geometry = geometry;
}
lyrind= document.getElementById("hidLayerIndex").value;
query.outFields = ["*"];
var queryTask = new esri.tasks.QueryTask(servicename+lyrind);
// Perform the query, and call the data linking routine with
// the results once the query executes successfully.
dojo.connect(queryTask, "onComplete", geometryQuery_Complete);
queryTask.execute(query);
}
// The query is done, now we'll take the query results to do the data linking
function geometryQuery_Complete(featureSet) {
alert(featureSet.features.length);//Its showing length = 0
if ((featureSet != null) && (featureSet.features.length > 0))
{
// If there is at least one result
var resultSymbol;
var feature = featureSet.features[0];
if(lyrind=="0" ){
resultSymbol= new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10,
new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,
new dojo.Color([255,0,0]), 1),
new dojo.Color([0,255,0,0.25]));
alert('in0');
}
else if(lyrind=="1" || lyrind=="8"){
resultSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID,
new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 0, 255, .8]), 2),
new dojo.Color([100, 100, 255, 0.8]));
alert('in1or8');
}
else
{
resultSymbol=new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([255,0,0]), 3);
alert('inelse');
}
// add the selection highlight
feature.setSymbol(resultSymbol);
// display the graphics for the selected feature
map.graphics.add(feature);
}
var code,disp;
if(lyrind=="0" || lyrind=="1" ||lyrind=="3")
{
code="FEATURECD";
disp ="OBJECTID";
}
else if(lyrind=="8" )
{
code="FEATURECODE";
disp ="SURVEY_NO";
}
var ddlVillage_ProjWiseBudget = document.getElementById("ddlVillage_ProjWiseBudget");
var context = 'SurveyNoSelection';
var argument = 'ControlType=SurveyNoSelection';
argument += '&SURVEY_NO=' + featureSet.features[0].attributes[disp];
argument += '&FEATURECODE=' + featureSet.features[0].attributes; eval(Planning_CallBack); }
Hi Hzhu,
My problem is in posted code for only polygon feature featureset will be retrieved. For Line and point feature featureset will be always empty. How can i get those feature's objectID "onDrawEnd".
Please help me.
// The query is done, now we'll take the query results to do the data linking
function geometryQuery_Complete(featureSet) {
alert(featureSet.features.length);//Its showing length = 0
}
Thanks in advance,
Sowmya
Hi Hzhu,
My problem is in posted code for only polygon feature featureset will be retrieved. For Line and point feature featureset will be always empty. How can i get those feature's objectID "onDrawEnd".
Please help me.
// The query is done, now we'll take the query results to do the data linking
function geometryQuery_Complete(featureSet) {
alert(featureSet.features.length);//Its showing length = 0
}
Thanks in advance,
Sowmya
Hi,
I understood.I tried with all different spatialrelationships. Still it is not returning any fearure on querycomplete