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

Angular 9 arcGIS GraphicLayers更新esri-loader

如何解决Angular 9 arcGIS GraphicLayers更新esri-loader

我必须创建一个ArcGIS地图,并在确定的坐标中确定点。我已经使用Graphicslayer模块创建了它们。但是从html模板调用函数时,我必须更新此点的图标。

这是初始化映射函数代码

 async initializeMap(mapViewEl: ElementRef) {
try {
  // Load the modules for the ArcGIS API for JavaScript
  const [
    Map,MapView,Graphic,Graphicslayer,Locate,Fullscreen,] = await loadModules([
    'esri/Map','esri/views/MapView','esri/Graphic','esri/layers/Graphicslayer','esri/widgets/Fullscreen','esri/widgets/Locate','esri/widgets/Zoom',]);

  loadCss();

  this.element = mapViewEl;
  // Configure the Map
  const mapProperties = {
    basemap: 'gray-vector',};

  this.map = new Map(mapProperties);

  // Initialize the MapView
  this.mapViewProperties = new MapView({
    container: mapViewEl.nativeElement,//Visual 2D
    center: [12.51133,41.89193],//[Longitudine,Latitudine]
    zoom: 5,map: this.map,});

  this._pointHttp.getPoints().subscribe((res) => {  //Takes points from a json file
    this.points = res;
  });

  var graphicslayer = new Graphicslayer();
  console.log('points',this.points);
  this.points.forEach((point) => {
    graphicslayer.add(new Graphic(point));
  });

  this.map.add(graphicslayer);
  const fullscreen = new Fullscreen({
    //Proprietà fullscreen
    view: this.mapViewProperties,});

  const locate = new Locate({
    //Proprietà geolocalizzazione
    view: this.mapViewProperties,useheadingEnabled: false,goToOverride: function (view,options) {
      options.target.scale = 1500; // Override the default map scale
      return view.goTo(options.target);
    },});

  //Aggiungi bottoni
  this.mapViewProperties.ui.add(locate,'top-right');
  this.mapViewProperties.ui.add(fullscreen,'top-right');
  this.mapViewProperties.ui.move('zoom','bottom-right');

  this.view = this.mapViewProperties;
  await this.view.when(); // wait for map to load
  return this.view;
} catch (error) {
  console.error('EsriLoader: ',error);
}

}

我正在使用Angular 9和esri-loader创建地图

我该怎么办?

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