微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

画布高度不断增加 Arcgis/core

如何解决画布高度不断增加 Arcgis/core

我在使用 Arcgis/core 4.18 时遇到问题。我的地图画布高度不断增加。我在 Angular 11 中使用 Arcgis/Core。

这是我的代码

app.component.html

<html>
  <head>
  </head>
  <body>
      <div id="viewDiv"></div>
  </body>
</html>
 

app-component.css

#viewDiv {
    padding: 0;
    margin: 0;
    height: 100%;
    width: 100%;
  }
 

app-component.ts

import { Component,OnInit} from '@angular/core';
import MapView from '@arcgis/core/views/MapView'; 
import config from '@arcgis/core/config';
import Map from '@arcgis/core/Map';
@Component({
  selector: 'app-root',templateUrl: './app.component.html',styleUrls: ['./app.component.scss']
})
export class AppComponent  {
  constructor() {
   }

  ngOnInit() {
    this.initMap();
  }

  initMap(){
    config.assetsPath = './assets';
    const map = new Map({
      basemap: "arcgis-topographic" //Basemap layer service
    });
    // Create a MapView instance (for 2D viewing) and reference the map instance
    const view = new MapView({
      map: map,center: [-118.80500,34.02700],//Longitude,latitude
      zoom: 13,container: "viewDiv"
  });
    view.when(() => console.log('view ready'));
  }

}

安装 npm arcgis/core

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。