如何将传单绑定到 JavaScript 中的坐标列表

How to convert a leaflet bound to a list of coordinate in JavaScript

我想将传单 LatLng 转换为以坐标列表表示的西南角和西北角列表。

我有的是

{
  _northEast: o.LatLng {lat: 10.01479, lng: 76.36605}
  _southWest: o.LatLng {lat: 10.01103, lng: 76.36062}
}

我想得到

((10.01103, 76.36062),(10.01479, 76.36605))

$scope.bound 保存所绘制矩形的边界。

将坐标表示为坐标列表,

console.log($scope.bound);
// { _northEast: o.LatLng {lat: 10.01479, lng: 76.36605}, _southWest: o.LatLng {lat: 10.01103, lng: 76.36062} }

southWest = $scope.bound.getSouthWest();

northEast = $scope.bound.getNorthEast();

$scope.coordinates = '((' + southWest.lat + ',' + southWest.lng + '), (' + northEast.lat + ',' + northEast.lng + '))'

console.log($scope.coordinates);
// ((10.01103, 76.36062),(10.01479, 76.36605))