我正在尝试在 Angular 2 中实现一个应用程序,其中一个模块专门用于满足地图可视化的所有需求。我希望能够在 MapView 和 SceneView 之间切换(以获得具有地面高程的 3D 视图)。除了地面海拔,我能够让一切正常工作。我不知道这是否是其他东西的角度 2 的问题,但是当我用旧版本 (4.0) 替换当前 API (4.1) 时,会显示地面高程,但是文档中的所有示例都使用 4.1 所以它一定是我的问题。有人遇到同样的问题吗?
ngOnInit() {
let self = this
this.setSceneView().then(function (obj: SceneView) {
self.actualView = obj;
obj.on("click",(e) => self.onMapClick(e));
});
}
private setSceneView() {
return new SceneView({
container: this.elmentRef.nativeElement.lastChild.firstChild,
map: new Map({ basemap: 'topo', ground: 'world-elevation' }),
zoom: this.zoom,
center: this.center,
});
}
Systemjs.config.js
(function (global) {
System.config({
paths: {
// paths serve as alias
'npm:': 'node_modules/',
moment: 'node_modules/moment/moment.js'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
app: 'app',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
// other libraries
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api',
'ng2-bootstrap': 'npm:ng2-bootstrap',
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
main: './main.js',
defaultExtension: 'js'
},
rxjs: {
defaultExtension: 'js'
},
'angular-in-memory-web-api': {
main: './index.js',
defaultExtension: 'js'
},
'ng2-bootstrap': {
main: './ng2-bootstrap.js',
defaultExtension: 'js'
}
}
});
esriSystem.register(
// array of Esri module names to load and then register with SystemJS
[
//"dojo/on",
'esri/Map',
'esri/core/Collection',
'esri/layers/FeatureLayer',
'esri/renderers/SimpleRenderer',
'esri/symbols/Symbol',
'esri/symbols/SimpleMarkerSymbol',
'esri/symbols/SimpleLineSymbol',
'esri/Graphic',
'esri/Color',
'esri/geometry/Polygon',
'esri/geometry/Polyline',
'esri/geometry/Point',
'esri/views/View',
'esri/views/MapView',
"esri/views/SceneView",
'esri/widgets/Widget',
'esri/widgets/BasemapToggle',
'esri/request'
],
// optional callback function
function () {
// then bootstrap application
System.import('app/main').then(null, console.error.bind(console));
});