Kyle Pena
unread,Oct 18, 2010, 12:56:51 AM10/18/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Maps JavaScript API v3
Hi folks - my end game is calling the function
fromContainerPixelToLatLng, but in order to get there, I need an
instance of projection to play with. But projection is undefined no
matter how hard I try.
Code:
function getGMap() {
var myLatlng = new google.maps.LatLng(...elided...);
var myOptions = {
zoom: 19,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.SATELLITE,
draggable: true, /* You can move by dragging around */
scaleControl: false, /* But the control is not visible */
disableDefaultUI: true, /* Remove all the distracting
google maps UI stuff */
disableDoubleClickZoom: true, /* And you can't double
click to zoom */
scrollwheel: false /* And you can't scroll to zoom */
};
var map = new google.maps.Map($(".map")[0], myOptions);
// set up a prototype for google maps
MyOverlay.prototype = new google.maps.OverlayView();
MyOverlay.prototype.onAdd = function() { };
MyOverlay.prototype.onRemove = function() { };
MyOverlay.prototype.draw = function() { };
function MyOverlay(map) { this.setMap(map); };
// set up the GMap overlay (not the same as the HTML5 overlay
I made)
// without setting up this overlay, google maps won't be able
to get an instance of the projection, which we need for unit
calculations
var overlay = new MyOverlay(map);
var projection = overlay.getProjection();
MyApp.Projection = projection;
return map;
};
What's wrong?