Javascript 限制

Javascript 限制,javascript,google-maps,Javascript,Google Maps,我已经找到了一些东西,但仍然找不到正确的答案。 我通过我的输入(使用谷歌地图自动完成)获得位置,所以我最终得到了long和lat。 我需要得到SWLat/Long和NELat/Long。 所以我尝试使用边界,所以我使用了它: var resultBounds = new google.maps.LatLngBounds( new google.maps.LatLng(long, lat)); latNEValue = resultBounds.getNorthEast().

我已经找到了一些东西,但仍然找不到正确的答案。 我通过我的输入(使用谷歌地图自动完成)获得位置,所以我最终得到了long和lat。 我需要得到SWLat/Long和NELat/Long。 所以我尝试使用边界,所以我使用了它:

    var resultBounds = new google.maps.LatLngBounds(
    new google.maps.LatLng(long, lat));


 latNEValue = resultBounds.getNorthEast().lat();
longNEValue = resultBounds.getNorthEast().lng();
latSWValue = resultBounds.getSouthWest().lat();
longSWValue = resultBounds.getSouthWest().lng();
我的问题是这些值是2乘2相等的(latNE==lat==latSW和longNE==long=longSW)。 我找不到正确的解决办法。
感谢您抽出时间。

有一个google.maps.LatLngBounds对象与(的
.viewport
)关联。最好使用它(如果它存在,如果不知道,它将为空)