Question

I have found this code and it works very well but I'd like to know how to get that information, longitude and latitude of the draggable marker. This is the code: Draggable Marker

Was it helpful?

Solution

If you want to retrieve the coordinate of the marker while you're dragging the marker in the map control (or after), you can use the dedicated events.

Here is a updated version based on your code:

// 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);

Here is also a complete example: http://developer.here.com/apiexplorer/examples/api-for-js/markers/draggable-markers.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top