React google 地图 getBounds

React google map getBounds

我使用 react-google-maps 库,当我通过函数 getBounds 获取边界时。我得到了看起来像这样的对象

_.Kc {f: Jc, b: Fc}
 b:Fc {b: -69.44550556640627, f: -69.37409443359377}
 f:Jc {b: 5.843139027557267, f: 5.958055017316458}
 __proto__:Object

我需要左下边界 (lat, lng) 和右上边界 (lat, lng)。 你能告诉我数字 b 和 f 是多少吗? 哪个是左下边界lat,左下边界lng,右上边界lat,右上边界lng。我找不到任何文档

Map.getBounds method returns LatLngBounds value 其中

represents a rectangle in geographical coordinates, including one that crosses the 180 degrees longitudinal meridian

使用

示例:

    onMapIdle={() => {
        let ne = this.map.getBounds().getNorthEast();
        let sw = this.map.getBounds().getSouthWest();
        console.log(ne.lat() + ";" + ne.lng());
        console.log(sw.lat() + ";" + sw.lng());
      }}

这里有一个demo供大家参考