Skip to content

Commit ee027d2

Browse files
committed
【bug】1) tileFormat传入webp,出图结果不对。
2)4326底图,叠加29873坐标系的restData服务,没有出图 (reviewed by chengl)
1 parent ba0685e commit ee027d2

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/openlayers/core/Util.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,9 @@ export class Util {
349349
* @param {object} serviceOptions - 服务类需要的参数
350350
* @param {function} processCompleted - 成功请求的回调函数
351351
* @param {function} processFaild - 失败请求的回调函数
352+
* @param {string | number} targetEpsgCode - 动态投影的目标坐标系对应的 EPSG Code
352353
*/
353-
static getFeatureBySQL(url, datasetNames, serviceOptions, processCompleted, processFaild) {
354+
static getFeatureBySQL(url, datasetNames, serviceOptions, processCompleted, processFaild, targetEpsgCode) {
354355
let getFeatureParam = new FilterParameter({
355356
name: datasetNames.join().replace(':', '@')
356357
// attributeFilter: 'SMID > 0' // shp第三方发布的数据没有SMID字段,http://yt.ispeco.com:8099/issue/DV-131
@@ -361,7 +362,8 @@ export class Util {
361362
fromIndex: 0,
362363
toIndex: 100000,
363364
maxFeatures: 100000,
364-
returnContent: true
365+
returnContent: true,
366+
targetEpsgCode
365367
}),
366368
callback = (serviceResult) => {
367369
if (serviceResult.type === 'processCompleted') {

src/openlayers/mapping/WebMap.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ export class WebMap extends Observable {
315315
if (handleResult.action === "BrowseMap") {
316316
that.createSpecLayer(mapInfo);
317317
} else if (handleResult.action === "OpenMap") {
318-
that.baseProjection = handleResult.newCrs ||mapInfo.projection;
318+
that.baseProjection = handleResult.newCrs || mapInfo.projection;
319319
that.webMapVersion = mapInfo.version;
320320
that.baseLayer = mapInfo.baseLayer;
321321
// that.mapParams = {
@@ -352,7 +352,7 @@ export class WebMap extends Observable {
352352
}
353353

354354
/**
355-
* 处理坐标系
355+
* 处理坐标系(底图)
356356
* @private
357357
* @param {string} crs 必传参数,值是webmap2中定义的坐标系,可能是 1、EGSG:xxx 2、WKT string
358358
* @param {string} baseLayerUrl 可选参数,地图的服务地址;用于EPSG:-1 的时候,用于请求iServer提供的wkt
@@ -1068,8 +1068,8 @@ export class WebMap extends Observable {
10681068
});
10691069
options.tileGrid = tileGrid;
10701070
}
1071-
//主机名相同时不添加代理
1072-
if (layerInfo.url && !this.isSameDomain(layerInfo.url)) {
1071+
//主机名相同时不添加代理,iportal geturlResource不支持webp代理
1072+
if (layerInfo.url && !this.isSameDomain(layerInfo.url) && layerInfo.format !== 'webp') {
10731073
options.tileProxy = this.server + 'apps/viewer/getUrlResource.png?url=';
10741074
}
10751075
let source = new TileSuperMapRest(options);
@@ -1715,7 +1715,7 @@ export class WebMap extends Observable {
17151715
that.sendMapToUser(len);
17161716
that.errorCallback && that.errorCallback(e, 'getLayerFaild', that.map);
17171717
})
1718-
}else if (layer.layerType === 'SUPERMAP_REST' ||
1718+
} else if (layer.layerType === 'SUPERMAP_REST' ||
17191719
layer.layerType === "WMS" ||
17201720
layer.layerType === "WMTS") {
17211721
if (layer.layerType === "WMTS") {
@@ -1967,7 +1967,7 @@ export class WebMap extends Observable {
19671967
allDatas: {
19681968
features: result.result.features.features
19691969
},
1970-
fileCode: layer.projection,
1970+
fileCode: that.baseProjection, //因为获取restData用了动态投影,不需要再进行坐标转换。所以此处filecode和底图坐标系一致
19711971
featureProjection: that.baseProjection
19721972
});
19731973
that.addLayer(layer, features, layerIndex);
@@ -1977,7 +1977,7 @@ export class WebMap extends Observable {
19771977
that.layerAdded++;
19781978
that.sendMapToUser(layerLength);
19791979
that.errorCallback && that.errorCallback(err, 'getFeatureFaild', that.map)
1980-
});
1980+
}, that.baseProjection.split("EPSG:")[1]);
19811981
}
19821982

19831983
/**

0 commit comments

Comments
 (0)