Skip to content

Commit ba0685e

Browse files
committed
【bug】1) webMap,请求restData服务,返回的feature中包含空geometry,导致地图加载失败报错
(reviewed by chengl)
1 parent a447ccd commit ba0685e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/openlayers/mapping/WebMap.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2322,7 +2322,10 @@ export class WebMap extends Observable {
23222322
featureProjection: metaData.featureProjection || this.baseProjection || 'EPSG:4326'
23232323
});
23242324
//geojson格式的feature属性没有坐标系字段,为了统一,再次加上
2325-
let coordinate = feature.getGeometry().getCoordinates();
2325+
let geometry = feature.getGeometry();
2326+
// 如果不存在geometry,也不需要组装feature
2327+
if(!geometry) {continue;}
2328+
let coordinate = geometry.getCoordinates();
23262329
if (allFeatures[i].geometry.type === 'Point') {
23272330
properties.lon = coordinate[0];
23282331
properties.lat = coordinate[1];

0 commit comments

Comments
 (0)