You're absolutely right.

Thanks for pointing this out to us Magnus.  I'll update the example
with the recommended fix.


Thanks!

Dann

On Jan 23, 1:44 pm, "Magnus O." <[email protected]>
wrote:
> Hi,
>
> I just looked at this 
> example:http://code.google.com/apis/maps/documentation/v3/examples/map-coordi...
>
> I found that there is an error in the example on line 47-48:
>
> MercatorProjection.prototype.fromPointToLatLng = function(point) {
>   var me = this;
>
>   var origin = me.pixelOrigin_;
>   var lng = (pixel.x - origin.x) / me.pixelsPerLonDegree_;
>   var latRadians = (pixel.y - origin.y) / -me.pixelsPerLonRadian_;
>   var lat = radiansToDegrees(2 * Math.atan(Math.exp(latRadians)) -
> Math.PI / 2);
>   return new google.maps.LatLng(lat, lng);
>
> };
>
> This:
>   var lng = (pixel.x - origin.x) / me.pixelsPerLonDegree_;
> Should be:
>  var lng = (point.x - origin.x) / me.pixelsPerLonDegree_;
>
> And this:
>  var latRadians = (pixel.y - origin.y) / -me.pixelsPerLonRadian_;
> Should be:
>  var latRadians = (point.y - origin.y) / -me.pixelsPerLonRadian_;
>
> point instead of pixel...
>
> Maybe you should update the example?
>
> Magnus

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