Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with openlayers 5.0.2 #43

Closed
HymanL opened this issue Dec 4, 2019 · 4 comments
Closed

Error with openlayers 5.0.2 #43

HymanL opened this issue Dec 4, 2019 · 4 comments

Comments

@HymanL
Copy link

HymanL commented Dec 4, 2019

在使用过程中,发现这个过程不断的出错误。是我用的方式不对嘛?react 16.11.0 ol是5.0.2

错误:windLayer.esm.js:917 Uncaught (in promise) TypeError: this.get is not a function
at OlWind.getMap (windLayer.esm.js:917)
报错指向这个方法:/**

  • get map
    */
    OlWindy.prototype.getMap = function getMap () {
    return this.get('originMap');
    };
    下面贴上我的部分代码
@HymanL
Copy link
Author

HymanL commented Dec 4, 2019

let map = new Map({
controls: defaultControls({
attribution: false,
zoom: false,
rotate: false,
}).extend([]),
layers: layers,
target: this.refs.cesiumContainer,
view: new View({
projection: 'EPSG:4326',
center: [117.509569, 38.346416],
zoom: 14,
minZoom: 12,
maxZoom: 19,
}),
});
Map.viewerObj = map;

var wind = new windLayer.OlWind(out, {
  layerName: '',
  minResolution: undefined,
  maxResolution: undefined,
  zIndex: 6,
  projection: 'EPSG:4326',
  ratio: 1
});
map.addLayer(wind);

@sakitam-fdd
Copy link
Owner

@HymanL ol5+暂时请使用以下方式(PS: 后面会将ol 和 openlayers的包合并):

import WindLayer from 'wind-layer/dist/OlWindy.esm.js';

var wind = new WindLayer(out, {
  layerName: '',
  minResolution: undefined,
  maxResolution: undefined,
  zIndex: 6,
  projection: 'EPSG:4326',
  ratio: 1
});
map.addLayer(wind);

@HymanL
Copy link
Author

HymanL commented Dec 4, 2019 via email

@sakitam-fdd
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants