0
目前我可以檢索使用獲取谷歌地圖地圖左側中心或右中心點
new google.maps.LatLng(map.getCenter().lat(), map.getCenter().lng());
我現在所要做的,就是讓左,中心的地圖的中心點或者地圖的右中心點。例如: Link to example image
據我所知,目前還沒有內置的谷歌地圖API函數來獲取這兩種觀點。
目前我可以檢索使用獲取谷歌地圖地圖左側中心或右中心點
new google.maps.LatLng(map.getCenter().lat(), map.getCenter().lng());
我現在所要做的,就是讓左,中心的地圖的中心點或者地圖的右中心點。例如: Link to example image
據我所知,目前還沒有內置的谷歌地圖API函數來獲取這兩種觀點。
就可以得到約束
var bounds = map.getBounds();
var ne = bounds.getNorthEast();
var sw = bounds.getSouthWest();
然後拿到拉特和LNGS
eg in Nothern - Western area (otherwise check for min and max lat and lng):
middleLat = sw.lat() + (ne.lat() - sw.lat())/2;
你的左中心中間的
(middleLat, sw.lng())
您的權利中心在
(middleLat, ne.lng())
https://stackoverflow.com/questions/1831634/how-to-get-left-top-and-right-buttom-latitude-and-longitude-of-map-in-mapkit –
@HemaNandagopal你發佈的鏈接正在使用Swift和mapkit。正如您可以從我使用Google Maps API的標籤中看到的,而不是使用mapkit和Javascript,而不是Swift。謝謝你的努力。 – Musa