区分缩放标签中的重叠折线5km

时间:2016-10-22 07:21:03

标签: javascript leaflet

我有3个标记 A B C ,其中2个标记之间的距离 A B 只有12米,最后一个标记 C 离标记 A B 太远(1200 km),当我在它们之间绘制折线时,我在Marker A C B C 行之间获得单线在5公里的缩放级别重叠,如何在传单Map API中的Zoom级别5km区分这2条线? 下面是我用来实现相同的代码。

var markerGroup = []

var A_LatLngObj = L.latLng(25.168595184684936, 75.84935768356826)
var B_LatLngObj = L.latLng(25.168532184684936, 75.84931268356826)
var C_LatLngObj = L.latLng(23.18376518685702, 77.45881298879502)

var marker_A = L.photoMarker(A_LatLngObj, {
                src: nodeMarkerSrc,
                size: [40, 40]
            });

var marker_B = L.photoMarker(B_LatLngObj, {
                src: nodeMarkerSrc,
                size: [40, 40]
            });

var marker_B = L.photoMarker(C_LatLngObj, {
                src: nodeMarkerSrc,
                size: [40, 40]
            });

markerGroup.push(marker_A);
markerGroup.push(marker_B);
markerGroup.push(marker_C);

var customPolyline = L.Polyline.extend({options: {data:''}});
var linkObj_AtoC = new customPolyline([A_LatLngObj, C_LatLngObj], {
                    data: linkData,
                    color: utilizationColor,
                    type: 'line',
                    fillColor: '#00a924',
                    fillOpacity: 1,
                    opacity: 10,
                    weight: 2,
                    clickable: true
                });


var linkObj_BtoC = new customPolyline([B_LatLngObj, C_LatLngObj], {
                    data: linkData,
                    color: utilizationColor,
                    type: 'line',
                    fillColor: '#00a924',
                    fillOpacity: 1,
                    opacity: 10,
                    weight: 2,
                    clickable: true
                });

markerGroup.push(linkObj_AtoC);
markerGroup.push(linkObj_BtoC);

map.addLayer(L.layerGroup(markerGroup));

0 个答案:

没有答案