首页 / 浏览问题 / 云GIS / 问题详情
前端查询REST数据服务报错
3EXP 2018年03月01日

从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('查询失败!');
            }

1个回答

您好,您可以参考范例数据集查询中的sql查询。
4,524EXP 2018年03月01日
...