3
我有一個頁面,其中包含建築物的衛星視圖和對齊的平面圖覆蓋圖。有些圖片需要與建築物內的特定位置相關聯,因此我想拖動圖片,將其放在地圖上,並將位置數據用於其他任務。在Google地圖上啓用拖放的準確標記位置
我有這個概念在
http://130.111.148.131/JMCTour/admin/setCoordinates.php?floor=1,
工作,但標記準確性極不理想。如果您去該網站並放置一個標記,您可以看到位置差異很大。這是真實的,無論使用
point = (pageX, pageY),
point = (screenX, screenY),
location = overlay.getProjection().fromDivPixelToLatLng(point),
location = overlay.getProjection().fromcontainerPixelToLatLng(point)
我的代碼是
//draggable handler of each photo
$(".photo").draggable({
helper: "clone",
cursor: "move",
containment: $("#photosGallery") ? $("#container") : "document"
});
//droppable handler of the map div
$("#map").droppable({
drop: function(e){
var point = new google.maps.Point(e.pageX, e.pageY);
var data = {
"location": overlay.getProjection().fromDivPixelToLatLng(point)
};
placeMarker(data);
}
});
//create a new marker overlay at point
function placeMarker(location){
var marker = new google.maps.Marker({
position: location.location,
map: map,
zIndex: 1000,
draggable: true
});
}
我想有精度工作。儘管確實可以放置一個位置並將其拖到正確的位置,但在第一個位置準確定位會非常有幫助