Brad,

I have an updated version of Proj.js, the last one had some syntax errors
(this one still might, but I have removed all that I could find, code just
needs to be run now), let me know and I can send it over to you.  Also here
is the changes I made to Google.js for the conversions.

-----------------------Google.js-------------------------

   getLongitudeFromMapObjectLonLat: function(moLonLat) {
       if( this.projectionCon ){
           var points = this.projectionCon.Forward( new Array(moLonLat.lng(),
moLonLat.lat()) );
           return points[0];
       }
       return moLonLat.lng();
   },

   getLatitudeFromMapObjectLonLat: function(moLonLat) {
       if( this.projectionCon ){
           var points = this.projectionCon.Forward( new Array(moLonLat.lng(),
moLonLat.lat()) );
           return points[1];
       }
       return moLonLat.lat();
   },

   projectionCon: null,

   getMapObjectLonLatFromLonLat: function(lon, lat) {
       if( this.projectionCon ){
           var points = this.projectionCon.Inverse( new Array(lon, lat) );
           return new GLatLng(points[1], points[0]);
       }
       return new GLatLng(lon, lat);
   },

   /*  There is probably a better way to do this */
   setOLtoMapObjectAPITranslation: function(){
       this.projection = this.map.projection;
       if( this.map['resolutions'] ){
          this.resolutions = this.map['resolutions'];
       }
       this.projectionCon = new OpenLayers.Proj (this.projection);
   },

Finally, here is a function I am working on to fix some of the zoom extent
problems (when switching between layers and for getting the zoom box to
work) .  Still needs more testing.

    getZoomForExtent: function( bounds ){
       var moBounds = null;
       if (bounds != null && this.projectionCon) {
           var point = this.projectionCon.Inverse( new Array(bounds.left,
bounds.bottom ) );
           var sw = new GLatLng(point[1], point[0]);
           point = this.projectionCon.Inverse( new Array(bounds.right,
bounds.top) );
           var ne = new GLatLng(point[1], point[0]);
           moBounds = new GLatLngBounds(sw, ne);
           newZoom = this.mapObject.getBoundsZoomLevel(moBounds);
           if( newZoom != 0 ){
               return newZoom;
           }
           return this.map.zoom;
       }
       return this.map.zoom;
    },

-Justin
_______________________________________________
Dev mailing list
[email protected]
http://openlayers.org/mailman/listinfo/dev

Reply via email to