src/map/Map.Topo.js
function (coord1, coord2) {
        if (!this.getProjection()) {
            return null;
        }
        const p1 = new Coordinate(coord1),
            p2 = new Coordinate(coord2);
        if (p1.equals(p2)) {
            return 0;
        }
        return this.getProjection().measureLength(p1, p2);
    }
function (coord1, coord2) {
        if (!this.getProjection()) {
            return null;
        }
        const p1 = new Coordinate(coord1),
            p2 = new Coordinate(coord2);
        if (p1.equals(p2)) {
            return 0;
        }
        return this.getProjection().measureLength(p1, p2);
    }
function ( coord1 , coord2 ) { if ( ! this . getProjection ( ) ) { return null ; } const p1 = new Coordinate ( coord1 ) , p2 = new Coordinate ( coord2 ) ; if ( p1 . equals ( p2 ) ) { return 0 ; } return this . getProjection ( ) . measureLength ( p1 , p2 ) ; }
Caculate distance of two coordinates.
@param {Number[]|Coordinate} coord1 - coordinate 1
@param {Number[]|Coordinate} coord2 - coordinate 2
@return {Number} distance, unit is meter
@example
var distance = map.computeLength([0, 0], [0, 20]);
Caculate distance of two coordinates .