I just started using openlayers 5 in my angular 6 and I follow this tutorial and also looking this SO question. My angular component right now has
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';
in my class
olmap: ol-map;
source: ol-xyz;
layer: ol-tile;
view: ol-view;
and then in my 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
});
This works but I dont get the styling of the openlayers. I get the zoom buttons as simple, unstyled buttons, under the map div
. What am I missing here? How can I insert the opelayers css style?
Thanks