Just use the fromDivPixelToLatLng() function :)
(passing in the pixel coordinates you have calculated as per the image)

I know I strugged, to find a good example, of its use, from one of my
sites...

var overlay = null;

function update_map() {

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

        if (prevCenter && map.getZoom() == prevZoom) {
                var point1 = 
overlay.getProjection().fromLatLngToContainerPixel(center);...


shows one way to get a MapCanvasProjection object.

(you could possibly store the projection in a variable, rather than
calling overlay.getProjection()
each time)





On Fri, Oct 28, 2011 at 6:21 PM, pinksy <[email protected]> wrote:

> Hi
>
> I'm really sorry if this has been answered - I can't find a clear answer,
> and am struggling to figure it out from the documentation...
>
> I have a map with known dimensions, and one side of the map will be
> obscured by a DIV which will have a variable width, leaving a visible
> portion of the map on the left. What I'm trying to figure out is the LatLng
> at the center of the visible portion.
>
> I can easily work out the pixel co-ordinates of the center point of the
> visible area (as shown below), but I can't get my head around how to
> translate that into a LatLng.
>
> Can anyone give me some pointers?
>
> Thanks in advance.
>
>
> <https://lh4.googleusercontent.com/-q1GJ9qmrojM/Tqrj2r8PLLI/AAAAAAAAARw/ke1OyvZpExg/latlng.jpg>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google Maps JavaScript API v3" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-maps-js-api-v3/-/jzlxFB2Vjf0J.
> 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.
>

-- 
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