M
M
Maxim2012-12-29 12:18:19
JavaScript
Maxim, 2012-12-29 12:18:19

Yandex.Maps API 2.0, getting Placemark's coordinates?

API version 2.0. The geoObjects array contains a number of Placemark elements, that is, marks.
The task is to get the current coordinates on the screen of the selected marker, or its offset from the upper left edge of the map area. In pixels. That is, it is not at all about geographical coordinates.
I have custom popup layers on the 'mouseover' of the labels. When the event is triggered, there are no problems to take the coordinates - we take e.get ('position'), that is, the current coordinates of the cursor.
The question is how to get the coordinates when you want to display a pop-up layer at a certain label without hovering over.
Any ideas are welcome!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikolai Vasilchuk, 2012-12-29
@docomo

You know map center coordinates, marker coordinates, map area size, and map scale. This data should be enough to calculate the label's offset from the center of the map.

A
Alexey Likhachev, 2015-07-10
@Playbot

myPlacemark.events.add('drag', function(events){
        console.log(myPlacemark.geometry.getCoordinates());
    });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question