我刚开始在我的 angular 6 中使用 openlayers 5,我按照本教程进行操作,并且还在查看这个 SO question。我的角度组件现在有
import ol-map from 'ol/map';
import ol-xyz from 'ol/source/xyz';
import ol-tile from 'ol/layer/tile';
import ol-view from 'ol/View';
import * as ol-proj from 'ol/proj';
在我的课上
olmap: ol-map;
source: ol-xyz;
layer: ol-tile;
view: ol-view;
然后在我的ngOnInit
this.source = new ol-xyz({
url: 'https://api.tiles.mapbox.com/v4/mapbox.light/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw'
});
this.layer = new ol-tile({
source: this.source
});
this.view = new ol-view({
center: ol-proj.fromLonLat([6.661594, 50.433237]),
zoom: 3,
});
this.olmap = new ol-map({
target: 'map',
layers: [this.layer],
view: this.view
});
这可行,但我没有得到 openlayers 的样式。我在 map 下将缩放按钮作为简单的无样式按钮div
。我在这里想念什么?如何插入 opelayers css 样式?
谢谢