Skip to content

code521/leaflet.tools.measure

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leaflet.tools.measure

leaflet 测距工具

DEMO

https://loongship.github.io/leaflet.tools.measure/examples/index.html

安装

npm install leaflet.tools.measure

开启测距的两种方法

  1. 初始化地图的时候增加measureControl 属性,控件右下角会出现测绘控件.

    var map = L.map('map', {
        center: [31, 122],
        measureControl: true,   //初始化传入参数measureControl
        zoom: 5
    })
    
  2. 控件单独初始化

    var control = L.control.measure({}).addTo(map)
    

常用方法

//开启测距
control.start()

//关闭测距
control.stop()

主意

单位长度为海里,当距离大于1000米的时候显示海里

About

工具-测距

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%