开发者

Getting the pixel co-ordinates of a Google map marker

开发者 https://www.devze.com 2022-12-08 11:38 出处:网络
Is it possible to determine the pixel co-ordinates of a given marker, taking into account current zoom leve开发者_如何学编程l and visible area of the map?Current (v3):

Is it possible to determine the pixel co-ordinates of a given marker, taking into account current zoom leve开发者_如何学编程l and visible area of the map?


Current (v3):

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

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

Old (v2):

The method fromLatLngToContainerPixel following should give you what you're after, assuming markerPoint is your marker, and zoomLevel your current zoom:

map.fromLatLngToContainerPixel(markerPoint.getLatLng(), zoomLevel);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号