How to call fromLatLngToDivPixel in Google Maps API V3?

Jader Dias picture Jader Dias · Oct 8, 2009 · Viewed 42.4k times · Source

I know that method exists and is documented, but I don't know how to get an MapCanvasProjection object.

Answer

TMS picture TMS · Nov 23, 2011

Look at http://qfox.nl/notes/116

var overlay = new google.maps.OverlayView();
overlay.draw = function() {};
overlay.setMap(map);
var point = overlay.getProjection().fromLatLngToDivPixel(latLng); 

Ugly indeed. Much easier in v2 - another flaw of google api v3!