[OpenLayers-Users] Fixing Google Layers, OL SVN + OL <= 2.4

samd sdoyle_2 at yahoo.com
Tue Sep 18 17:36:52 EDT 2007


This worked great Chris.

Thanks again!

S.D.



Christopher Schmidt-4 wrote:
> 
> On Tue, Sep 18, 2007 at 01:46:24PM -0700, samd wrote:
>> 
>> Yes Chris,
>> 
>> I added the change you mentioned to the start of my onload routine before
>> the map/layers are created but the JavaScripts are loaded.
> 
> Sam:
> 
> I'm sorry. The previous code provided was mistaken. The Wiki Page is now
> updated to code which will work. Instead of the previous snippet, you
> should do:
> 
> OpenLayers.Layer.Google.prototype.addContainerPxFunction=function() {
>     if (typeof GMap2 != "undefined" && !GMap2.fromLatLngToContainerPixel)
> {
>        
>         GMap2.prototype.fromLatLngToContainerPixel = function(gLatLng) {
>         
>             // first we translate into "DivPixel"
>             var gPoint = this.fromLatLngToDivPixel(gLatLng);
>                 
>             // locate the sliding "Div" div
>             var div = this.getContainer().firstChild.firstChild;
>                 
>             // adjust by the offset of "Div" and voila!
>             gPoint.x += div.offsetLeft;
>             gPoint.y += div.offsetTop;
>             
>             return gPoint;
>         };  
>     }   
> };  
> 
> 
> Please let us know if this does not fix the problem.
> 
> Regards,
> -- 
> Christopher Schmidt
> MetaCarta
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://www.nabble.com/Fixing-Google-Layers%2C-OL-SVN-%2B-OL-%3C%3D-2.4-tf4476705.html#a12766670
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list