从iServer自带的CBD数据发布的REST数据服务,查询时报错;
有没有从发布REST数据服务,到前端如何查询的完整教程呢?
doSqlQuery();
function onQueryComplete(queryEventArgs) {
var selectedFeatures = queryEventArgs.originResult.features;
for (var i = 0; i < selectedFeatures.length; i++) {
var value = selectedFeatures[i].fieldValues["0"];
IDs.push(parseInt(value) + 11);
}
console.log(IDs)
}
function doSqlQuery() {
var getFeatureParam, getFeatureBySQLService, getFeatureBySQLParams;
getFeatureParam = new SuperMap.REST.FilterParameter({
attributeFilter: "SMAREA>5000"
});
getFeatureBySQLParams = new SuperMap.REST.GetFeaturesBySQLParameters({
queryParameter: getFeatureParam,
toIndex: -1,
datasetNames: ["二维数据:" + "Building"]
});
var url = 'http://localhost:8090/iserver/services/data-CBD/rest/data';
getFeatureBySQLService = new SuperMap.REST.GetFeaturesBySQLService(url, {
eventListeners: {
"processCompleted": onQueryComplete,
"processFailed": processFailed
}
});
getFeatureBySQLService.processAsync(getFeatureBySQLParams);
}
function processFailed(queryEventArgs) {
console.log(queryEventArgs)
alert('查询失败!');
}