使用Leaflet.Draw工具栏以英尺为单位显示折线长度 [英] Display Polyline length in feet using Leaflet.Draw toolbar

查看:364
本文介绍了使用Leaflet.Draw工具栏以英尺为单位显示折线长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个地图,用户可以使用Leaflet.Draw工具栏绘制线条.我希望以英尺/英里(而不是默认的码/英里)显示行的行驶距离.在GitHub上查看该项目,在我看来,以下代码应该执行此操作:

I am creating a map that the user will be able to draw lines on using the Leaflet.Draw toolbar. I would like the running distance of the line to be displayed in feet/miles instead of the default yards/miles. Looking at the project in GitHub, it seems to me the following code should do this:

 var drawControl = new L.Control.Draw({
            draw: {
                polyline: {
                    shapeOptions: {
                        color: 'red',
                    },
                    metric: false,
                    feet: true,
                }
            }            
        });

但是长度仍然以码显示.深入了解为什么这样做会有所帮助.

But the length is still displayed in yards. Any insight into why this is would be helpful.

推荐答案

哪个版本的 Leaflet.draw 您正在使用插件吗?

Which version of Leaflet.draw plugin are you using?

请注意:

  • Leaflet.draw version v0.2.4 / 0.2.4-dev (as used in the plugin GitHub demo) does not have the feet option yet.
  • Leaflet.draw version v0.3.0 / 0.3.0-dev (latest release for Leaflet 0.7) has the feet option.
  • Leaflet.draw from leaflet-master branch, for compatibility with Leaflet 1.0, is based on version 0.2.4 and does not have the feet option.

这篇关于使用Leaflet.Draw工具栏以英尺为单位显示折线长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆