首页 > 解决方案 > EagleView/Pictometry:无法读取 i._walkAnnotations 处未定义的属性“isCollection”

问题描述

我正在与 EagleView 的 Pictometry 地图 API 集成。

为什么在我提出标准addShapes()请求时会出现此问题。这就是我正在做的事情:

我已经将 PictometryHost 实例化为,并且我有一个这样的 latLong 对this.ipa数组:squares{lat: xxx, lng: xxx}

    const squarePolygons = squares.map((square) => {
      const shape = {
        type: this.ipa.SHAPE_TYPE.POLYGON,
        coordinates: panel,
        strokeColor: 'white',
        strokeOpacity: 1.0,
        strokeWeight: 1.0,
        fillColor: '#000000',
        fillOpacity: 1.0,
      }
      return shape
    })

    this.ipa.addShapes(panelPolygons)

标签: javascriptmaps

解决方案


当您在shape对象上发送无效属性时会发生这种情况。

显然,这不是一个非常有用的错误消息。终于想通了,我想我会把它放在这里以防它帮助别人。基本上,当 Pictometry API 接收到任何无效属性时,就会引发此不透明错误。

在这种情况下,该coordinates属性是一个对象数组,这是正确的,但每个坐标必须采用格式{x: [], y: []}而不是直接的 lat/lng 对。

有关更多信息,请参阅此处的addShapes文档。

此外,Pictometry 无法识别 html 颜色,因此该strokeColor属性必须是“ #FFFFFF”而不是“白色”。


推荐阅读