Hi, I think I am looking for the same information but the links above did not completely answer it for me. I need to get the pixel co-ordinates of a point within my map div and I am having trouble figuring it out from the world co-ordinates. If I mulitply them by 2 to the power of zoom as described in the link above, I get the number of pixels from 0,0 on the whole map, not the current view (i.e. div container). Is there a straightforward method to get this information? I can't seem to figure it out. Thanks.
On Mar 1, 1:39 pm, Marcelo <[email protected]> wrote: > On Mar 1, 5:31 pm, Thai Dang Vu <[email protected]> wrote: > > > I looked at the v3 API reference and noticed that if I want to use methods > > like fromLatLngToDivPixel ... I need a MapCanvasProjection object. And to > > have a MapCanvasProjection object, I need an OverlayView object. > > Look at this > example:http://code.google.com/apis/maps/documentation/v3/examples/map-coordi... > It contains a MercatorProjection object. > > ... and the explanation of how things work in > V3:http://code.google.com/apis/maps/documentation/v3/overlays.html#Custo... > Pay special attention to "World Coordinates". > > -- > Marcelo -http://maps.forum.nu > -- > > > > > In my situation, I don't have any overlay on the map. For example, I show > > the road map at some (lat, lng) and at some zoom level. Now I need to know > > the pixel position when the user clicks on the map. To do that in v2, I > > listen to the map click event where I have the (lat, lng) and use > > map.fromLatLngToDivPixel. In v3, the object map doesn't have that method. > > How I can do the same thing in v3? > > > Thank you. -- 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.
