关于arcgis:arcgis-for-js根据经纬度添加图片标注

44次阅读

共计 539 个字符,预计需要花费 2 分钟才能阅读完成。

1. 申明三个包

  • esri/layers/GraphicsLayer
  • esri/Graphic
  • esri/geometry/Point
    2. 申明 GraphicsLayer 并且 add 到 map 外面
    3. 初始化图片标记点并且 add 到 GraphicsLayer

    async ShowLocation() {
        let that = this
        const Graphic = await arcgisPackage.Graphic
        const GraphicsLayer = await arcgisPackage.GraphicsLayer
        const Point = await arcgisPackage.Point
        
        let layer = new GraphicsLayer()
        that.map.add(layer)
    
        var symbol = {
          type: "picture-marker",
          url: require('../../../assets/img/onepicture/ta.png'),// 图片地址
          width: "64px",
          height: "64px"
        };
        var point = new Point(103.880812,27.802255);
        var gp = new Graphic(point,symbol);
    
        layer.graphics.add(gp);
      },

正文完
 0