ionic4集成高德地圖踩坑(二)

使用TileLayer.Satellite添加衛星圖到地圖上。
貼代碼

        var satellite = new AMap.TileLayer.Satellite();
        this.map = new AMap.Map(this.map_container.nativeElement, {
            view: new AMap.View2D({//創建地圖二維視口
                zoom:14, //設置地圖縮放級別
                rotateEnable: true,
                showBuildingBlock: true,
                center: [116.397428, 39.90923],//設置地圖中心點座標
                layers: [satellite],  //設置圖層,可設置成包含一個或多個圖層的數組
                mapStyle: 'amap://styles/whitesmoke',  //設置地圖的顯示樣式
                viewMode: '2D',  //設置地圖模式
                lang:'zh_cn',  //設置地圖語言類型
            }),
        });

沒有效果
這裏寫圖片描述

於是看着官網實例改了一下

        var satellite = new AMap.TileLayer.Satellite();
        var roadNet = new AMap.TileLayer.RoadNet();
        this.map = new AMap.Map(this.map_container.nativeElement, {
                zoom:14, //設置地圖縮放級別
                rotateEnable: true,
                showBuildingBlock: true,
                center: [116.397428, 39.90923],//設置地圖中心點座標
                layers: [satellite],  //設置圖層,可設置成包含一個或多個圖層的數組
                mapStyle: 'amap://styles/whitesmoke',  //設置地圖的顯示樣式
                viewMode: '2D',  //設置地圖模式
                lang:'zh_cn',  //設置地圖語言類型
        });

這裏寫圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章