[OpenLayers-Dev] [OpenLayers-Trac] [OpenLayers] #686: Treat Google Layer as projected data

Christopher Schmidt crschmidt at metacarta.com
Fri Aug 31 16:30:41 EDT 2007


On Fri, Aug 31, 2007 at 08:18:50PM -0000, OpenLayers wrote:
> #686: Treat Google Layer as projected data

>  I don't know how much testing we want to do on this, but I'm tapped out on
>  it: for now, marking review just to garner comments from anyone interested
>  in the code. This is just a diff between
>  http://dev.openlayers.org/sandbox/tschaub/google/ and trunk -- The code
>  can be checked out from:
> 
>  http://svn.openlayers.org/sandbox/tschaub/google/
> 
>  and the way you use it is to set:
> 
>  sphericalMercator: true
> 
>  as an option on the layer.
> 
>  I think this is going to be the final API: the GoogleMercator layer is
>  going to go away, and it's just going to be an option on the layer.

Essentially, this is probably now API complete: 
 * You create your map with a maxExtent in spherical-mercator projected
   meters.
 * You add a Commercial base layer to that map with the
   'sphericalMercator': true option set.  
 * You add overlays to that map. 

This means that your overlays must support EPSG:900913 (or you can
override it after creating your layer if they support it via some other
number) -- the proj4/WKT is in the SphericalMercator.js file (which will
also show in the docs once this is in trunk).

The canonical example is:

http://dev.openlayers.org/sandbox/tschaub/google/examples/spherical-mercator.html

Tim's put together a number of different layers here, demonstrating the
functionality of the layer with a TileCache-powered WMS overlay, to
demonstrate that yes, Virginia, there really is a Google layer you can
lay TileCache down on top of.

Now is the time for API complaints -- and also the time for tests, if
you want to write them. Things which could use testing:
 * In the test_SphericalMercator.html file, add functions for
   initialization of each:
    * Google
    * VirtualEarth
    * Yahoo
   and ensure that:
    * If sphericalMercator is set, they have inverse/forward proj
      functions
    * RESOLUTIONS is set to appropriate values if sphericalMercator is
      set
    * If sphericalMercator is not set, those layers dont have the
      inverse/forward projection functions
    * if sphericalMercator is not set, units aren't touched
 * Create a test in SphericalMercator.html for checking tha
   initMercatorParameters sets the proper units, and resolutions  based
   on MIN_ZOOM_LEVEL and MAX_ZOOM_LEVEL.

If you've got a sandbox account, feel free to commit tests directly into
the sandbox.

Questions? Comments? Complaints?

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Dev mailing list