Getting the pixel coordinates of a Google map marker

Is it possible to determine the coordinates of the pixels of this marker, taking into account the current zoom level and the visible area of ​​the map?

+3
source share
1 answer

Current (v3):

map.getProjection().fromLatLngToPoint(marker.position);

https://developers.google.com/maps/documentation/javascript/3.exp/reference#Projection

Old (v2):

The fromLatLngToContainerPixel method should give you what you need if it markerPointis your marker and zoomLevelyour current increase:

map.fromLatLngToContainerPixel(markerPoint.getLatLng(), zoomLevel);
+4
source

Source: https://habr.com/ru/post/1719865/


All Articles