Skip to content

Instantly share code, notes, and snippets.

Created April 22, 2010 14:15
Show Gist options
  • Save anonymous/375274 to your computer and use it in GitHub Desktop.
Save anonymous/375274 to your computer and use it in GitHub Desktop.
// once the google maps is loaded, put a Raphael canvas on top of it
// be sure to apply margin:0 to the body in this case
var point = new GLatLng(46.065375, 5.448974);
var pixel = map.fromLatLngToContainerPixel(point);
var paper = Raphael(0, 0, 400, 300);
var circle = paper.circle(pixel.x, pixel.y, 10);
circle.attr("fill", "#f00");
circle.attr("stroke", "#fff");
@erikmohn
Copy link

Note that this is for Google Maps v2

v3:

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

var point = new google.maps.LatLng(59.423950, 10.643005);

  var projection = overlay.getProjection();
  var pixel = projection.fromLatLngToDivPixel(point); 

  var paper = Raphael(0, 0, 400, 300);

var circle = paper.circle(pixel.x, pixel.y, 10);
circle.attr("fill", "#f00");
circle.attr("stroke", "#fff");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment