我试图根据查询返回给定要素的几何。它适用于某些功能,但对于其余功能,它返回null。任何人都知道我的代码可能有什么问题? 我提前感谢您的回答......
var advQueryTask = new QueryTask(finQuerURL);
advQueryTask.disableClientCaching = true;
var advQuery = new Query();
if (typeof curMapLyr.layerDefinitions[curLayerID] === 'undefined') {
advQuery.where = whrCls;
}
else {
advQuery.where = curMapLyr.layerDefinitions[curLayerID] + ' and (' + whrCls + ')';
}
console.log(advQuery);
advQuery.outFields = retCols;
advQuery.geometry= map.extent;
advQuery.returnGeometry = true;
advQueryTask.useAMF = false;
advQuery.outSpatialReference = map.spatialReference;
// advQuery.outFields = ["*"];
advQueryTask.execute(advQuery, showAdvQueryRes);
}
else {
alert('Please select a column to search by.');
}
});
}
function showAdvQueryRes(res) {
++selectionCntr;
var curSelectNum = selectionCntr;
dynamicIDs['select_' + curSelectNum] = res;
if (res.features.length > 0) {
addResults(curSvcID, curLayerID, curSelectNum);
}
else {
alert('No results were found. Please try again.');
}
hideLoading();
}
答案 0 :(得分:1)
如果有人遇到同样的问题,我得到了答案。我必须通过功能转到mxd文件并在其中启用形状字段(它们可以通过Arc map打开)!