I want to add my custom div with marker in google map. However, when I use fromLatLngToContainerPixel() or fromLatLngToDivPixel() or fromLatLngToPoint(), it always says that undefined. In details, it's anonymous function.
I've already checked,
How to call fromLatLngToDivPixel in Google Maps API V3?
How to access Google Maps API v3 marker's DIV and its pixel position?
But, they don't work for me. What can I do?
Here is the code.
Outside of initialize(),
var overlay = new google.maps.OverlayView();
overlay.draw = function() {};
overlay.setMap(map);
And inside the initialize(),
google.maps.event.addListener(init_marker, 'click', function(){
infoWindow.open(map, init_marker);
var latlng = init_marker.getPosition();
var px = overlay.getProjection().fromLatLngToPoint(latlng);
});