您好,需要引入SuperMap iClient for OpenLayers才能使用该接口,具体引入方式可参考:
https://iclient.supermap.io/web/introduction/openlayersDevelop.html#Ready
希望能够帮助到您!
您接口调用方式不正确,正确调用方式:
var param = new ol.supermap.QueryBySQLParameters({ queryParams: { name: "Capitals@World.1", attributeFilter: "SMID < 10" } });
new ol.supermap.QueryService(url).queryBySQL(param).then(function (serviceResult) { var vectorSource = new ol.source.Vector({ features: (new ol.format.GeoJSON()).readFeatures(serviceResult.result.recordsets[0].features), wrapX: false }); resultLayer = new ol.layer.Vector({ source: vectorSource }); map.addLayer(resultLayer); });
可以参考:https://iclient.supermap.io/examples/openlayers/editor.html#01_mapQueryBySQL