Leaflet Map Control.Scale—一个简单的比例控件

Leaflet Map Control.Scale—一个简单的比例控件

一个简单的比例控件,以公制(m/km)和英制(mi/ft)显示当前屏幕中心的比例。扩展控制。

A simple scale control that shows the scale of the current center of screen in metric (m/km) and imperial (mi/ft) systems. Extends Control.

Usage example

L.control.scale().addTo(map);

Creation

FactoryDescription
L.control.scale(<Control.Scale options
options?)
Creates an scale control with the given options.
使用给定选项创建缩放控件。

Options

OptionTypeDefaultDescription
maxWidthNumber100Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500).
控件的最大宽度(以像素为单位)。动态设置宽度以显示舍入值(例如100、200、500)。
metricBooleanTrueWhether to show the metric scale line (m/km).
是否显示公制刻度线(m/km)。
imperialBooleanTrueWhether to show the imperial scale line (mi/ft).
是否显示英制刻度线(米/英尺)。
updateWhenIdleBooleanfalseIf true, the control is updated on moveend, otherwise it’s always up-to-date (updated on move).
如果为true,则控件在moveend时更新,否则它总是最新的(在移动时更新)。

▶ Options inherited from Control

从控件继承的选项

OptionTypeDefaultDescription
positionString'topright'The position of the control (one of the map corners). Possible values are 'topleft''topright''bottomleft' or 'bottomright'
控件的位置(地图角之一)。可能的值为“topleft”、“topright”、“bottomleft”或“bottomright”

Methods

▶ Methods inherited from Control

从控件继承的方法

MethodReturnsDescription
getPosition()stringReturns the position of the control.
返回控件的位置。
setPosition(<string>
 position)
thisSets the position of the control.
设置控件的位置。
getContainer()HTMLElementReturns the HTMLElement that contains the control.
返回包含控件的HTMLElement。
addTo(<Mapmap)thisAdds the control to the given map.
将控件添加到给定的映射。
remove()thisRemoves the control from the map it is currently active on.
从当前处于活动状态的贴图中删除控件。
0 0 投票数
文章评分
订阅评论
提醒
0 评论
内联反馈
查看所有评论
0
希望看到您的想法,请您发表评论x