【问题标题】:How to get google map js polyline coordinates after editing?编辑后如何获取谷歌地图js折线坐标?
【发布时间】:2021-10-26 10:00:31
【问题描述】:

我正在使用绘图管理器(谷歌地图 JS)绘制一条折线,在完成线绘制后,我得到了折线的坐标,但是当我尝试编辑绘制的线时,坐标没有改变。

我正在添加工作堆栈闪电战 URL Refer here

请在这些问题上帮助我,

提前致谢。

【问题讨论】:

    标签: angular typescript google-maps


    【解决方案1】:

    添加 mouseup 监听器可以解决这个问题。

    https://stackblitz.com/edit/angular-draw-polygon-google-maps-g5pbc9?file=app%2Fapp.component.ts

      overlayClickListener(overlay) {
        var self =this;
        google.maps.event.addListener(overlay, "mouseup", function(event){
            self.centers = overlay
            .getPath()
            .getArray()
            .map((coord) => {
              return {
                lat: coord.lat(),
                lng: coord.lng(),
              };
            });
        });
      }
    

    【讨论】:

    • 它的工作 Alex Yu,谢谢
    • @SaiCharan np,请投票并接受答案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-10-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多