var interactionLine, vectorLayerMea, feature;
var urlMea = "
http://support.supermap.com.cn:8090/iserver/services/map-world/rest/maps/World/"; //服务访问的地址
var sourceMea = new ol.source.Vector({ wrapX: false });
vectorLayerMea = new ol.layer.Vector({
source: sourceMea
});
map.addLayer(vectorLayerMea);
interactionLine = new ol.interaction.Draw({
source: sourceMea,
type: "LineString"
});
interactionLine.on('drawstart', function (evt) {
feature = evt.feature;
});
interactionLine.on('drawend', function () {
var distanceMeasureParam = new SuperMap.MeasureParameters(feature.getGeometry());
new ol.supermap.MeasureService(urlMea, { measureMode: "" }).measureDistance(distanceMeasureParam, function (serviceResult) {
alert(serviceResult.result.distance + "m");
});
});
map.addInteraction(interactionLine);
这个url再4326坐标下可用 3857 不可以