2012-12-11 47 views
2

我目前在MapFragment中定義了多個GroundOverlays。我使用LatLngBounds創建每個GroundOverlay,並且大部分內容都對齊;然而,一些GroundOverlays結束了一點點。創建後GroundOverlay邊界發生變化

如果我在創建後記錄邊界,它們符合我的期望。我第二次登錄它們時,它們稍微偏離了一點。

LatLngBounds bounds = new LatLngBounds(new LatLng(point1_lat, point1_lon), new LatLng(point2_lat, point2_lon)); 

Log.d(TAG, "Bounds southwest: " + bounds.southwest.latitude + ", " + bounds.southwest.longitude); 
Log.d(TAG, "Bounds northeast: " + bounds.northeast.latitude + ", " + bounds.northeast.longitude); 

GroundOverlay groundOverlay = getMap().addGroundOverlay(new GroundOverlayOptions() 
         .image(bitmapDescriptor) 
         .positionFromBounds(bounds) 
        ); 

Log.d(TAG, "southwest: " + groundOverlay.getBounds().southwest.latitude + ", " + groundOverlay.getBounds().southwest.longitude); 
Log.d(TAG, "northeast: " + groundOverlay.getBounds().northeast.latitude + ", " + groundOverlay.getBounds().northeast.longitude); 

任何想法爲什麼GroundOverlay創建會使經緯度發生變化?

回答

0

它可能是圖像被調整,以確保寬度/高度有長度是2.從文檔的動力......

注意:當圖像被添加到該地圖將被轉換爲具有兩個冪的邊的圖像。您可以通過使用維度爲2的原始圖像來避免此轉換 - 例如,128x512或1024x1024。

Andy。