[mapguide-users] Adding zoom levels to Google maps layer

cheesybiscuits thomaschristian at gmail.com
Fri Jul 5 12:20:03 PDT 2013


I noticed that when adding a Google Maps basemap to my Fusion application the
available zoom levels changed and I could not zoom further than 1:1128.5.
Without the Google layer I could zoom in to something like 1:35.

I eventually figured out where the resolutions were being set and overrode
the OpenLayers.Layer.Google.prototype.initResolutions function to add an
arbitrary number of resolutions and increase the numZoomLevels variable
(code below).

I found that this gave me additional zoom levels but beyond a certain point
the Google Maps layer stopped zooming. My MapGuide layer continued zooming
but the Google imagery remained the same and so the referencing got out of
line. My solution was to hook into the zoomstart or zoomend event from
OpenLayers and disable the Google layer before this happens, but I'd prefer
to have the imagery 'blow up' as if it were still zooming. The reason for
this is that my users are redlining over very small areas so must be very
zoomed-in to the map for the work. They want the Google layer to remain
visible and are happy with the potential inaccuracies in Google's data.

I'd like to know if there's value in continuing to pursue this - is there a
hard restriction somewhere in Fusion or OpenLayers that says I can never see
the blown-up Google image once I zoom beyond the data limits? Is there
something simple I can change to alter how OpenLayers handles the further
reaches of this layer?

Any thoughts much appreciated. I'm using Fusion with Autodesk Infrastructure
Map Server 2013 on Windows 2008 R2 64-bit, Chrome 27


function addZoomLevels(levelsToAdd, windowObj) {

    windowObj.OpenLayers.Layer.Google.prototype.initResolutions = function
(original, levelsToAdd) {
        return function () {
            original.apply(this);
            this.numZoomLevels += levelsToAdd;

            window.GoogleLayer.originalMaxResolution =
this.resolutions[this.resolutions.length - 1];

            for (i = 0; i < levelsToAdd; i++) {
               
this.resolutions.push(this.resolutions[this.resolutions.length - 1] / 2);
            }
        };
    }(windowObj.OpenLayers.Layer.Google.prototype.initResolutions,
levelsToAdd);
}



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Adding-zoom-levels-to-Google-maps-layer-tp5064386.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list