Я использую Angular 7
, OpenLayers 5.3.0
(ol
).Я новичок в OpenLayers
.Кажется, я не могу найти примеры Angular 2+
с OverLayers
.Я пытаюсь следовать примерам https://openlayers.org/en/latest/examples/index.html и заставить код работать для Angular 2+
.
Использование OpenLayers 4 с Angular 5 очень полезно.Но в других случаях мне трудно заставить работать импорт модулей OpenLayers
.
Например, вот JavaScript
версия:
var map = new OpenLayers.Map({
div: "map",
layers: [new OpenLayers.Layer.OSM()],
controls: [
new OpenLayers.Control.Navigation({
dragPanOptions: {
enableKinetic: true
}
}),
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.Zoom()
],
center: [0, 0],
zoom: 1
});
Как импортировать модуль OpenLayers
'Control' в Angular 2+
?Я пытался
import OlMap from 'ol/Map';
import OlXYZ from 'ol/source/XYZ';
import OlTileLayer from 'ol/layer/Tile';
import OlView from 'ol/View';
import * as ol from 'ol';
this.map = new OlMap({
target: 'map',
layers: [this.layer],
view: this.view,
controls: [
new ol.control.navigation({
dragPanOptions: {
enableKinetic: true
}
}),
new ol.control.attribution(),
new ol.control.zoom()
],
});
Но получил ошибку export 'Control' (imported as 'ol') was not found in 'ol'
.Какие-либо предложения?Спасибо.