Skip to content

Commit 8b8c55e

Browse files
committed
【fix】修复webmap打开按行政区划上图不显示的问题
1 parent f56746d commit 8b8c55e

File tree

4 files changed

+2013
-1953
lines changed

4 files changed

+2013
-1953
lines changed

src/openlayers/mapping/BaiduMap.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export class BaiduMap extends TileImage {
6262
.replace('{z}', tileCoord[0].toString())
6363
.replace('{x}', tileCoord[1].toString())
6464
.replace('{y}', function() {
65-
console.log(Util.getOlVersion());
6665
var y = ['4', '5'].indexOf(Util.getOlVersion()) > -1 ? tileCoord[2] : -tileCoord[2] - 1;
6766
return y.toString();
6867
})

src/openlayers/mapping/WebMap.js

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2031,7 +2031,7 @@ export class WebMap extends Observable {
20312031
//行政规划信息
20322032
data.content.rows.unshift(data.content.colTitles);
20332033
let { divisionType, divisionField } = layer.dataSource.administrativeInfo;
2034-
let geojson = that.excelData2FeatureByDivision(data.content, divisionType, divisionField);
2034+
let geojson = await that.excelData2FeatureByDivision(data.content, divisionType, divisionField);
20352035
features = that._parseGeoJsonData2Feature({
20362036
allDatas: { features: geojson.features },
20372037
fileCode: layer.projection
@@ -2621,7 +2621,7 @@ export class WebMap extends Observable {
26212621
* @returns {Object} geojson对象
26222622
*/
26232623
excelData2FeatureByDivision(content, divisionType, divisionField) {
2624-
let me = this;
2624+
26252625
let asyncInport;
26262626
if (divisionType === 'Province') {
26272627
asyncInport = window.ProvinceData;
@@ -2631,10 +2631,33 @@ export class WebMap extends Observable {
26312631
// let geojso;
26322632
asyncInport = window.AdministrativeArea;
26332633
}
2634-
if (asyncInport) {
2635-
let geojson = me.changeExcel2Geojson(asyncInport.features, content.rows, divisionType, divisionField);
2636-
return geojson;
2634+
if(asyncInport){
2635+
return new Promise(resolve => {
2636+
resolve(this.changeExcel2Geojson(asyncInport.features, content.rows, divisionType, divisionField));
2637+
});
2638+
}
2639+
if(divisionType === 'GB-T_2260'){
2640+
return new Promise(resolve => {
2641+
resolve({
2642+
type: 'FeatureCollection',
2643+
features: []
2644+
});
2645+
});
26372646
}
2647+
const dataName = divisionType === 'City' ? 'MunicipalData' : 'ProvinceData';
2648+
const dataFileName = divisionType === 'City' ? 'MunicipalData.js' : 'ProvincialData.js';
2649+
const dataUrl = CommonUtil.urlPathAppend(this.server,`apps/dataviz/libs/administrative_data/${dataFileName}`);
2650+
return FetchRequest.get(this.getRequestUrl(dataUrl), null, {
2651+
withCredentials: false,
2652+
withoutFormatSuffix: true
2653+
})
2654+
.then(response => {
2655+
return response.text();
2656+
})
2657+
.then(result => {
2658+
new Function(result)();
2659+
return this.changeExcel2Geojson(window[dataName].features, content.rows, divisionType, divisionField);
2660+
});
26382661
}
26392662

26402663
/**

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy