var identifyTask, identifyParams, symbol;
//栅格function identify(Layer){ console.log("Console identifyRaster"); dojo.connect(app.map, "onClick", doIdentify); //实例化IdentifyTask identifyTask = new esri.tasks.IdentifyTask(Layer.url); //IdentifyTask参数设置 identifyParams = new esri.tasks.IdentifyParameters(); //冗余范围 identifyParams.tolerance = 3; //返回地理元素 identifyParams.returnGeometry = true; //进行Identify的图层 identifyParams.layerIds = [0]; //进行Identify的图层为全部 identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL; console.log("Console identifyRaster End");}//进行Identify
function doIdentify(evt){ console.log("Console doIdentify"); //清除上一次的高亮显示 app.map.graphics.clear(); //Identify的geometry identifyParams.geometry = evt.mapPoint; //Identify范围 identifyParams.mapExtent = app.map.extent; identifyTask.execute(identifyParams, function(idResults) { addToMap(idResults, evt); }); console.log("Console doIdentify End");}//在infoWindow中显示Identify结果
function addToMap(idResults, evt){ if(layerType == "Raster"){ //矢量处理方法 console.log("Console addToMap"); console.log("idResults[0]"+idResults[0]); console.log(idResults[0]); resultArray.push( Number(Number(idResults[0].feature.attributes["Pixel Value"]).toFixed(2)) ); var X = new Array(); var Y = new Array(); var arry = new Array(); X = resultArray; for(i = 0;i < X.length;i++){ console.log(X[i]); Y[i] = i; } arry[0]=X; arry[1]=Y; document.getElementById("columnChartPlot").innerText = ""; columnChart(arry); console.log("Console addToMap End"); }else{ //栅格处理方法 console.log("Console addToMap"); console.log(idResults[0]); var att ; if(idResults[0].feature.attributes.GRIDCODE){ att = idResults[0].feature.attributes.GRIDCODE }else{ if(idResults[0].feature.attributes["Class value"]){ att = Number(idResults[0].feature.attributes["Class value"]) } } console.log(att); resultArray.push( att ); var X = new Array(); var Y = new Array(); var arry = new Array(); X = resultArray; for(i = 0;i < X.length;i++){ console.log(X[i]); Y[i] = i; } arry[0]=X; arry[1]=Y; document.getElementById("columnChartPlot").innerText = ""; columnChart(arry); console.log("Console addToMap End"); }}