1

我找到了这段代码,它工作得很好,但我想知道如何获取可拖动标记的信息、经度和纬度。这是代码:可 拖动标记

4

1 回答 1

2

如果要在地图控件中(或之后)拖动标记时检索标记的坐标,可以使用专用事件。

这是基于您的代码的更新版本:

// Place this anywhere in the world.
var draggableMarker = new nokia.maps.map.StandardMarker([52.500556, 13.398889], 
{  
text:  "X",  
brush: {color: '#FF0000'} ,                 
draggable: true,                     
});   

// Add the listener function to the bubbling phase of the "dragend" event
draggableMarker.addListener("dragend", function(e) {
    var coordinate = display.pixelToGeo(e.displayX, e.displayY);
    alert(coordinate);
}, false);
// Add the marker to the map.
display.objects.add(draggableMarker);

这里也是一个完整的例子:http: //developer.here.com/apiexplorer/examples/api-for-js/markers/draggable-markers.html

于 2013-02-23T23:17:46.373 回答