Gis 在传单中,如何计算两个板条对象之间的像素距离?

Gis 在传单中,如何计算两个板条对象之间的像素距离?,gis,leaflet,mapbox,Gis,Leaflet,Mapbox,有一种latlng distanceTo方法: distanceTo(otherLatlng)Number返回距离(单位为 使用哈弗森公式计算的给定LatLng。 参见维基百科上的描述 它计算两个板条之间的距离(以米为单位)。然而,有时我需要知道两点之间有多少像素。有人对此有想法吗?您可以使用以下方法将坐标转换为屏幕点: 然后用以下方法测量两点之间的距离: distanceTo( <LatLng> otherLatlng ) Number Returns the dista

有一种latlng distanceTo方法:

distanceTo(otherLatlng)Number返回距离(单位为
使用哈弗森公式计算的给定LatLng。
参见维基百科上的描述

它计算两个板条之间的距离(以米为单位)。然而,有时我需要知道两点之间有多少像素。有人对此有想法吗?

您可以使用以下方法将坐标转换为屏幕点:

然后用以下方法测量两点之间的距离:

distanceTo( <LatLng> otherLatlng )  Number  Returns the distance (in
meters) to the given LatLng calculated using the Haversine formula.
See description on wikipedia