Skip to content

Commit 07bfec1

Browse files
committed
【update】支持二进制数据专题图自动更新
eidt by qiul review by zhaoq
1 parent ac9f5a1 commit 07bfec1

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/openlayers/mapping/WebMap.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,13 @@ export class WebMap extends Observable {
15361536
}
15371537
return;
15381538
}
1539-
let features = that.geojsonToFeature(data, layerInfo);
1539+
var features;
1540+
if (data.type === 'CSV' || data.type === 'EXCEL') {
1541+
features = that.excelData2Feature(data.content, layerInfo);
1542+
} else {
1543+
var geoJson = data.content ? JSON.parse(data.content) : data;
1544+
features = that.geojsonToFeature(geoJson, layerInfo);
1545+
}
15401546
if(len) {
15411547
//上图
15421548
that.addLayer(layerInfo, features, layerIndex);
@@ -2078,6 +2084,11 @@ export class WebMap extends Observable {
20782084
}
20792085
if(autoUpdateTime && !layerInfo.autoUpdateInterval) {
20802086
//自动更新数据
2087+
let dataSource = layerInfo.dataSource;
2088+
if (dataSource.accessType === "DIRECT" && !dataSource.url) {
2089+
// 二进制数据更新feautre所需的url
2090+
dataSource.url = `${this.server}web/datas/${dataSource.serverId}/content.json?pageSize=9999999&currentPage=1`
2091+
}
20812092
layerInfo.autoUpdateInterval = setInterval(() => {
20822093
that.updateFeaturesToMap(layerInfo, index, true);
20832094
}, autoUpdateTime);
@@ -2102,7 +2113,8 @@ export class WebMap extends Observable {
21022113
updateFeaturesToMap(layerInfo, layerIndex) {
21032114
let that = this, dataSource = layerInfo.dataSource, url = layerInfo.dataSource.url,
21042115
dataSourceName= dataSource.dataSourceName || layerInfo.name;
2105-
if(dataSource.type === "USER_DATA") {
2116+
2117+
if(dataSource.type === "USER_DATA" || dataSource.accessType==="DIRECT" ) {
21062118
that.addGeojsonFromUrl(layerInfo, null, layerIndex)
21072119
} else {
21082120
let requestUrl = that.getRequestUrl(url);

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