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 (将#修改为@)