[OpenLayers-Users] WMS layers dynamically re-projected on to Google Maps base layer--how does this work?

Mike Quentel mikequentel at yahoo.com
Mon May 21 18:20:12 EDT 2007


This is what I've found.  MetaCarta developers, please correct me if I'm wrong about this bit of reverse engineering...

In OpenLayers.Layer.FixedZoomLevels, in the initResolutions method, there is a test for the existence of array RESOLUTIONS.

OpenLayers.Layer.Google, MultiMap, VirtualEarth, and Yahoo all create and populate the array RESOLUTIONS.

So, given the following code in FixedZoomLevels...

       if (this.RESOLUTIONS != null) {
            var resolutionsIndex = 0;
            this.resolutions = [];
            for(var i= this.minZoomLevel; i < this.numZoomLevels; i++) {
                this.resolutions[resolutionsIndex++] = this.RESOLUTIONS[i];            
            }
        }

there is a test for this.RESOLUTIONS.  If it exists, RESOLUTIONS is used to populate the layer's resolutions.

If I turn on (make visible) a WMS layer in WGS84, the bounding box (BBOX) coordinates in lat/lon will be different than when the same WMS gets overlaid onto Google, at the same scale (in this test case 1:54k).

e.g.:

WMS, not on Google: &BBOX=-105.46873%2C39.726611%2C-105.380839%2C39.814501

WMS, overlaid on Google: &BBOX=-105.46875%2C39.744022%2C-105.380859%2C39.811569

Note that the EPSG value is the same in both request fragments above, i.e., EPSG: 4326.

Having a brief look at the FixedZoomLevels code, it appears that the extent (in lat/lon), resolution, and map width (pixels) are being used to determine the appropriate zoom levels.

MetaCarta, this correct?  Am I missing something?

Thank you.

Mike Quentel


----- Original Message ----
From: Mike Quentel <mikequentel at yahoo.com>
To: Tim Schaub <noreply at geocartic.com>; OpenLayers Users <users at openlayers.org>
Sent: Friday, 18 May, 2007 11:48:20 AM
Subject: Re: [OpenLayers-Users] WMS layers dynamically re-projected on to Google Maps base layer--how does this work?

Tim,

Thank you for the suggestions.

Some of the external WMS that my application attempts to pull in are in WGS84.  I see the suggestion of storing our data in Mercator.  Not sure if this would work for our architecture, though I see what you are saying about the possibility of improving performance with Google.

What I was hoping to understand is: how is Google Maps stretching the overlays?  Also, I'm hoping to find what Google class and method controls this.  Anyone that can explain this to me, I'd greatly appreciate it.  Sorry if this is something very obvious, but I don't understand what is happening in Google Maps that allows the WMS overlay to be stretched onto the Google base layer.  So the explanation might need to be dumbed down into layman's terms for me to understand.

Many thanks.

Mike Quentel

----- Original Message ----
From: Tim Schaub <noreply at geocartic.com>
To: OpenLayers Users <users at openlayers.org>
Sent: Friday, 18 May, 2007 11:20:43 AM
Subject: Re: [OpenLayers-Users] WMS layers dynamically re-projected on to Google Maps base layer--how does this work?

Hey-

Mike Quentel wrote:
> I saw a post concerning how a WMS can be overlayed on Google Maps.  

If you haven't figured this one out yet, here's an alternative:

If you can configure your servers or you can find data that is served up 
in Mercator, you can overlay any type of layer over Google with the 
(still experimental) GoogleMercator layer.

Since Google's data is projected in Mercator, it makes sense to me to 
treat it that way.  The Google maps API obscures this by transforming to 
coordinates to EPSG:4326 (longlat/WGS84).  This is handy for people who 
think in Lon/Lat, but it confuses things if you assume the imagery is 
projected in EPSG:4326.

So, if you let OpenLayers stay in Mercator and transform requests to the 
Google layer, you can overlay any layer in the same projection on top of 
Google's tiles - this is true for WMS, WFS, tiled, untiled, any vector 
data, etc.  The one requirement is that your data is served in Mercator 
as well.

If you can deal with Mercator, you'll get better performance letting the 
servers do the projecting.  You also get the ability to cache image 
tiles server side.

Just another option to add to your quiver.
See 
http://dev.openlayers.org/sandbox/tschaub/google/examples/google-mercator.html

This assumes the following:

# World Mercator
<54004> +proj=merc +lat_ts=0 +lon_0=0 +k=1.000000 +x_0=0 +y_0=0 
+ellps=WGS84 +datum=WGS84 +units=m  no_defs <>

Tim


_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users





    
    
        
___________________________________________________________ 
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users





      ___________________________________________________________ 
Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html 



More information about the Users mailing list