Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 使用角度+;ArcGIS API for JS:没有重载与此调用匹配_Angular_Typescript_Arcgis Js Api - Fatal编程技术网

Angular 使用角度+;ArcGIS API for JS:没有重载与此调用匹配

Angular 使用角度+;ArcGIS API for JS:没有重载与此调用匹配,angular,typescript,arcgis-js-api,Angular,Typescript,Arcgis Js Api,我正在使用ArcGIS API的Angular Typescript。一旦我从文档中复制了一些示例代码,它就有一些bug。我在下面粘贴了错误消息和代码 错误: 没有与此调用匹配的重载。重载1/2'(属性?: GraphicProperties):Graphic'出现以下错误。类型{Type: string;color:string;}'不可分配给类型 “符号属性”。对象文字只能指定已知属性, 并且类型“SymbolProperties”中不存在“type”。过载2/2, “(属性?:Graphi

我正在使用ArcGIS API的Angular Typescript。一旦我从文档中复制了一些示例代码,它就有一些bug。我在下面粘贴了错误消息和代码

错误:

没有与此调用匹配的重载。重载1/2'(属性?: GraphicProperties):Graphic'出现以下错误。类型{Type: string;color:string;}'不可分配给类型 “符号属性”。对象文字只能指定已知属性, 并且类型“SymbolProperties”中不存在“type”。过载2/2, “(属性?:GraphicProperties):Graphic”给出了以下错误。 类型“{Type:string;color:string;}”不可分配给类型 “符号属性”。对象文字只能指定已知属性, 而类型“SymbolProperties”中不存在“type”。ts(2769) interfaces.d.ts(5819,5):预期的类型来自属性 此处在类型“GraphicProperties”上声明的“symbol” interfaces.d.ts(5819,5):预期的类型来自属性 此处在类型“GraphicProperties”上声明的“symbol”

我的代码:

import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
 

import EsriMap from "@arcgis/core/Map";
import MapView from "@arcgis/core/views/MapView";
import Graphic from "@arcgis/core/Graphic";
import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer";
import Home from "@arcgis/core/widgets/Home";
import Track from "@arcgis/core/widgets/Track";
 

@Component({
  selector: 'app-map',
  templateUrl: './map.component.html',
  styleUrls: ['./map.component.css']
})
 

export class MapComponent implements OnInit {
  map: EsriMap;
  view: MapView;
 

  constructor() { }
 

  ngOnInit() {
 

    // Add Based Map
    const map = new EsriMap({
      basemap: "streets-vector"
    });
 

    // add initial view, position, and zoom
    const view = new MapView({
      map: map,
      container: "viewDiv",
      center: [-79.502938, 43.767854],
      zoom: 12
    });
 

    // adds the home widget to the top left corner of the MapView
    var homeWidget = new Home({
      view: view
    });
    view.ui.add(homeWidget, "top-left");
 

    const track = new Track({
      view: view,
      graphic: new Graphic({
        symbol: {
          type: "simple-marker",    // <-------- error here
          size: "12px",    // <-------- error here
          color: "green",
          outline: {    // <-------- error here
             color: "#efefef",
             width: "1.5px"
          }
        }
      }),
      useHeadingEnabled: false
    });
    view.ui.add(track, "top-left");



    // draw a point on a layer
    const point = { //Create a point
      type: "point",
      longitude: -79.502938,
      latitude: 43.767854
    };
 

    const simpleMarkerSymbol = {
      type: "simple-marker",
      color: [226, 119, 40],  // Orange
      outline: {
        color: [255, 255, 255], // White
        width: 1
      }
    };
 

    const graphicsLayer = new GraphicsLayer();
    map.add(graphicsLayer);
    const pointGraphic = new Graphic({
      geometry: point,    // <-------- error here
      symbol: simpleMarkerSymbol
    });
    graphicsLayer.add(pointGraphic);

  }
}
从'@angular/core'导入{Component,OnInit,ViewChild,ElementRef};
从“@arcgis/core/Map”导入EsriMap;
从“@arcgis/core/views/MapView”导入地图视图;
从“@arcgis/core/Graphic”导入图形;
从“@arcgis/core/layers/GraphicsLayer”导入GraphicsLayer;
从“@arcgis/core/widgets/Home”导入主页;
从“@arcgis/core/widgets/Track”导入轨迹;
@组成部分({
选择器:“应用程序地图”,
templateUrl:'./map.component.html',
样式URL:['./map.component.css']
})
导出类MapComponent实现OnInit{
地图:EsriMap;
视图:地图视图;
构造函数(){}
恩戈尼尼特(){
//基于添加的地图
常量映射=新EsriMap({
基本地图:“街道向量”
});
//添加初始视图、位置和缩放
const view=新地图视图({
地图:地图,
容器:“viewDiv”,
中心:[-79.502938,43.767854],
缩放:12
});
//将主页小部件添加到MapView的左上角
var homeWidget=新主页({
视图:视图
});
view.ui.add(homeWidget,左上角);
常数轨道=新轨道({
视图:视图,
图形:新图形({
符号:{

键入:“简单标记”,我用丑陋的方式写下:

   new Graphic({ symbol: this.txtSymbol as any });