1
我嘗試使用谷歌地圖API的Android V2的圖像添加到谷歌地圖:的GoogleMap的GroundOverlayOptions:擠壓圖像四個的LatLngBounds
mMap = googleMap;
LatLng sw = new LatLng(47.01377857060625, 8.305519705172628);
LatLng ne = new LatLng(47.01395211967171, 8.306270482717082);
LatLng nw = new LatLng(47.014014755501165, 8.305559697328135);
LatLng se = new LatLng(47.01370751919609, 8.306236284552142);
LatLngBounds latLngBounds = new LatLngBounds(sw, ne).including(nw).including(se);
GroundOverlayOptions groundOverlayOptions = new GroundOverlayOptions();
BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromAsset("t2c.png");
groundOverlayOptions.image(bitmapDescriptor);
groundOverlayOptions.positionFromBounds(latLngBounds);
mMap.addGroundOverlay(groundOverlayOptions);
不幸的是,LatLng
值不是100%準確,所以背景圖像不旋轉但根據Google傾斜:
如果邊界與原始高寬比不匹配,圖像將會傾斜。
只使用LatLng
sw
和ne
:
我不知道我應該怎麼能夠找出確切西南部的LatLng
和東北,所以我對定義一個多邊形的方式很感興趣,並用四個012來將圖像壓入其中作爲錨點。目前使用四個LatLng
看起來像這樣。使用LatLng
sw
,ne
,nw
和se
:
它有助於謝謝,你是否可能知道是否有可能參考這個問題上的觀點圖像不需要GPS LongLat?假設我想在像素座標x = 35/y = 54處在圖像上繪製一些東西。但由於圖像已經旋轉(「軸承」),我不知道如何引用這些點了。 – user3105453
是的,你必須做相對絕對的轉換。 通常情況下,您應該在兩個座標系中選取一對點(左上角,右下角)並找到公式,但在評論中解釋相當複雜,您應該開一個新問題 –