我试图根据查询返回给定特征的几何形状。它适用于某些功能,但对于其余功能,它返回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();
}

最佳答案

如果有人遇到同样的问题,我就会找到答案。我必须通过这些功能转到mxd文件,并在其中启用shape字段(可以通过Arc map打开)!

08-06 15:13