* @private * @function WebMap.prototype.isMvt * @description 判断当前能否使用数据服务的mvt上图方式 * @param {string} serviceUrl 数据服务的地址 * @param {string} datasetName 数据服务的数据集名称 * @param {boolean | undefined} proxy 是否带上代理 * @returns {Object} 数据服务的信息
(serviceUrl, datasetName, proxy)
| 4847 | * @returns {Object} 数据服务的信息 |
| 4848 | */ |
| 4849 | isMvt(serviceUrl, datasetName, proxy) { |
| 4850 | let that = this; |
| 4851 | return this.getDatasetsInfo(serviceUrl, datasetName).then((info) => { |
| 4852 | //判断是否和底图坐标系一直 |
| 4853 | if (info.epsgCode == that.baseProjection.split('EPSG:')[1]) { |
| 4854 | return FetchRequest.get(that.getRequestUrl(`${info.url}/tilefeature.mvt`, proxy), null, { |
| 4855 | withCredentials: that.isCredentail(info.url, proxy) |
| 4856 | }) |
| 4857 | .then(function (response) { |
| 4858 | return response.json(); |
| 4859 | }) |
| 4860 | .then(function (result) { |
| 4861 | info.isMvt = result.error && result.error.code === 400; |
| 4862 | return info; |
| 4863 | }) |
| 4864 | .catch(() => { |
| 4865 | return info; |
| 4866 | }); |
| 4867 | } |
| 4868 | return info; |
| 4869 | }); |
| 4870 | } |
| 4871 | |
| 4872 | /** |
| 4873 | * @private |
no test coverage detected