开始运行时 LabelLayer 调用addFeatures 的时候报错,后续再调用就不报错了
初始化的地方:
var strategy3 = new SuperMap.Strategy.GeoText();
strategy3.style = {
fontColor: "#1874CD",
fontWeight: "bold",
labelXOffset: 0,
labelYOffset: 50,
fontSize: "14px",
fill: false,
fillColor: "#FFFFFF",
fontOpacity: 1,
fillOpacity: 0,
stroke: false,
strokeColor: "#8B7B8B"
};
dongtailukiangLabelLayer = new SuperMap.Layer.Vector("LabelLayer", {
strategies: [strategy3]
});
调用的地方:
dongtailukiangLabelLayer.addFeatures([geotextFeature]);
错误信息:
Uncaught TypeError: Cannot read property 'getResolution' of null
at initialize.getViewPortPxFromLonLat (eval at <anonymous> (
http://test.zzz.cn/Scripts/SuperMap/libs/SuperMap-8.1.0-14126.js:3:1), <anonymous>:1:68128)
at initialize.getLabelPxLocation (eval at <anonymous> (
http://test.zzz.cn/Scripts/SuperMap/libs/SuperMap-8.1.0-14126.js:3:1), <anonymous>:1:488127)
at initialize.getDrawnLabels (eval at <anonymous> (
http://test.zzz.cn/Scripts/SuperMap/libs/SuperMap-8.1.0-14126.js:3:1), <anonymous>:1:486177)
at initialize.a.drawFeatures (eval at <anonymous> (
http://test.zzz.cn/Scripts/SuperMap/libs/SuperMap-8.1.0-14126.js:3:1), <anonymous>:1:497577)
at initialize.a.addFeatures (eval at <anonymous> (
http://test.zzz.cn/Scripts/SuperMap/libs/SuperMap-8.1.0-14126.js:3:1), <anonymous>:1:497235)