【问题标题】:leaflet.draw not showing distance markupLeaflet.draw 不显示距离标记
【发布时间】:2017-06-15 19:20:37
【问题描述】:
  • 铬 V58
  • Windows 10
  • 传单 1.0.3
  • Leaflet-draw 0.4.9

如下所示,使用 Leaflet 1.0 和 Leaflet draw 0.2.4,我得到了线条的文本距离和矩形的面积。

现在我只得到了圆圈的区域,但其他的什么都没有显示。这只是我,为什么以下不再有效?

(即我不再看到如下所示的 1425.65 公里)。

function addDrawLayer() {
    var options = null
    var map = MAP.map
    var drawings = new L.FeatureGroup()
    MAP.drawLayer = drawings
    map.addLayer(drawings)

    options = {
        shapeOptions: {
            showArea: true,
            clickable: true
        },
        metric: true,
        edit: {
            featureGroup: drawings
        }
    }
    var drawControl = new L.Control.Draw(options)
    map.addControl(drawControl)
    map.on('draw:created', function (e) {
        var type = e.layerType
        var layer = e.layer
        if (type === 'marker') {
            layer.bindPopup('A popup!')
        }
        drawings.addLayer(layer)
    });
}

【问题讨论】:

    标签: leaflet.draw


    【解决方案1】:

    Leaflet.Draw Issue

    0.4.9 的一个错误已修补到 0.4.10 - 但是,Leaflet.Draw 还不能与 Leaflet 1.1.0 一起使用,而且距离标记似乎仍然存在一些问题。

    同时,您的选项对象是不正确的架构。 ShapeOptions 是每个 draw 项目的一部分,可能具有该绘图工具的 shapeOption。

    draw: polygon: {shapeOptions: {showArea: true} }
    

    JSFiddle

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-30
      • 1970-01-01
      • 2021-08-09
      • 2018-01-30
      • 1970-01-01
      • 2019-01-18
      相关资源
      最近更新 更多