I'm trying to implement an application in Angular 2 where one module is dedicated to work with all the needs for map visualization. I want to be able to switch between MapView and a SceneView (to have a 3D view with the ground elevation). I was able to get everything working except the ground elevation. I do not know if it's a problem with angular 2 of something else, but when i replace the current API (4.1) with the older version (4.0) the ground elevation show up, But all the examples from the documentation use the 4.1 so it must be my problem. Anybody experience the same problem?
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));
});