On Oct 1, 11:50 pm, dc <[email protected]> wrote:
>
> These two centers are not the same (latitude value differs for nearly
> 20 degrees). Seems to me that mybounds.getCenter calculate just
> "aritmetic" center but map.getCenter take in account the changing
> geometry between on equator and poles.

That's right. The map is projected; GLatLngBounds isn't, it's just a
rectangle defined by its corners. How that rectangle appears on a map
depends on the projection. As GLatLngBounds has no projection, the
centre is simply the arithmetic centre.

> It there any way how to calculate real map center from GLatLngBounds?

I think you need to take the NE and SW corners (which are GLatLng) and
convert them to pixels in the map, because that handles the
projection. You can probably use either fromLatLngToContainerPixel or
fromLatLngToDivPixel, because you're simply doing arithmetic. Once you
have the two pixel points, find the centre arithmetically and then
convert that to the underlying GLatLng with the reverse method
(fromContainerPixelToLatLng or fromDivPixelToLatLng as appropriate).

That means you're not actually using the GLatLngBounds. You're
effectively overlaying that bounds on the map and doing the
calculations from the map, with its projection.

Andrew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to