2016-11-30 213 views
0

我想在Angular 2中實現一個應用程序,其中一個模塊專用於處理地圖可視化的所有需求。 我希望能夠在MapView和SceneView之間切換(以具有地面高程的3D視圖)。 我能夠讓除了地面標高以外的所有東西都能正常工作。 我不知道這是否是另一個角度2的問題,但是當我用舊版本(4.0)替換當前API(4.1)時,地面標高顯示爲 但是文檔中的所有示例都使用4.1所以它一定是我的問題。 有人遇到同樣的問題?esri地球世界海拔不工作

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)); 
 
    });

回答

0

它帶我一段時間,但我想不通,這裏的問題是有關的另一部分在索引文件中,腳本文件的順序是錯誤的。

<script src="node_modules/core-js/client/shim.min.js"></script> 
<script src="node_modules/zone.js/dist/zone.js"></script> 

<script src="node_modules/reflect-metadata/Reflect.js"></script> 
<script src="node_modules/systemjs/dist/system.src.js"></script> 

這應該是正確的順序,在我的情況下,Reflect.js是第一個插件。由於某種原因,以前的版本不會影響外部呼叫,但是使用最新的版本,這會殺死所有呼叫,這就是爲什麼我無法查看地面標高