Projections are not available until the onAdd method of the overlay
has been called. Since you are calling getProjection() immediately, it
isn't available yet.

Chad Killingsworth

On Mar 11, 3:05 pm, midimid <[email protected]> wrote:
> For example - just tried this code, and while the variable overview is
> correct, the variable projection is undefined:
>
> var mapCenter = new google.maps.LatLng(38.43, -98.17);
> var myOptions = {
>         zoom: 5,
>         center: mapCenter,
>         mapTypeId: google.maps.MapTypeId.ROADMAP};
>
> map = new google.maps.Map(document.getElementById("map_canvas"),
> myOptions);
> var overlay = new MyOverlay(map);
> var projection = overlay.getProjection();
>
> -----------------------------------
> MyOverlay.js:
> MyOverlay.prototype = new google.maps.OverlayView();
> MyOverlay.prototype.onAdd = function() { }
> MyOverlay.prototype.onRemove = function() { }
> MyOverlay.prototype.draw = function() { }
> function MyOverlay(map) { this.setMap(map); }
> -----------------------------------
>
> On Mar 11, 3:28 pm, midimid <[email protected]> wrote:
>
> > What I'm particularly not understanding as I rewrite this is how to
> > use the fromLatLngToPixel() method. How do I get the projection object
> > from my map so that I can use that function? My testing around using
> > the MercatorProjection example on the v3 docs was an epic fail (no
> > zoom input?) and I'm seeing alot of posts on the groups making me go
> > in circles with the OverlayView class, but no real solid answer on how
> > to get access to the Projection object.
>
> > On Mar 11, 12:27 pm, Brak <[email protected]> wrote:
>
> > > The following pages should have everything you'll need to convert or
> > > update the existing code to v3.
>
> > >http://code.google.com/apis/maps/documentation/v3/basics.htmlhttp://c...
>
> > > The main difference I've noticed is things are more heirarchic and
> > > object like now. So instead of GPoint and GLatLng as standalone
> > > functions, they are now methods of google.maps. So they'd be
> > > represented like google.maps.Point() and google.maps.LatLng(). It
> > > should be fairly straightforward.
>
> > > Of course if you have any specific questions about stuff that's giving
> > > trouble or doesn't makes sense, you can ask in this group. Be sure to
> > > include links and/or examples too.
>
> > > On Mar 11, 12:19 pm, midimid <[email protected]> wrote:
>
> > > > Unfortunately I'm a bit new to this and it uses some functionality
> > > > that I haven't even learned in the v3 API.
>
> > > > On Mar 11, 2:24 am, String <[email protected]> wrote:
>
> > > > > On Mar 9, 10:47 pm, midimid <[email protected]> wrote:
>
> > > > > > Was looking to use this, but it uses the v2 API. Anyone have 
> > > > > > something
> > > > > > similar for v3?
>
> > > > > Bill gives the source code right from that page, and on a cursory
> > > > > inspection I don't see anything there that wouldn't be doable in v3.
> > > > > So I'd say go ahead and translate it.
>
> > > > > String

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to