你好 我这边测试是没有问题的,你可以把我的这个例子复制到官网示例里面进行测试,看看是不是你的那些参数填写的有误
var map, resultLayer;
map = L.map('map', {
preferCanvas: true,
crs: L.CRS.EPSG3857,
center: [34, 108],
maxZoom: 18,
zoom: 3
});
L.supermap.tiledMapLayer("
http://support.supermap.com.cn:8090/iserver/services/map-china400/rest/maps/China").addTo(map);
resultLayer = L.featureGroup().addTo(map);
measureDistance();
function measureDistance() {
var polyLine = L.polyline([[25, 102], [40, 116]], {color: "red"});
var distanceMeasureParam = new SuperMap.MeasureParameters(polyLine);
console.log(polyLine)
L.supermap
.measureService("
http://support.supermap.com.cn:8090/iserver/services/map-china400/rest/maps/China")
.measureDistance(distanceMeasureParam, function (serviceResult) {
console.log(serviceResult)
});
}