[OpenLayers-Trac] [OpenLayers] #3626: Request for OpenLayers/examples/google-tiles-restrictedzoom.html

OpenLayers trac-20090302 at openlayers.org
Fri Feb 24 09:10:52 EST 2012


#3626: Request for OpenLayers/examples/google-tiles-restrictedzoom.html
---------------------+------------------------------------------------------
 Reporter:  ca0v     |       Owner:              
     Type:  feature  |      Status:  new         
 Priority:  minor    |   Milestone:  2.12 Release
Component:  general  |     Version:  2.11        
 Keywords:           |       State:              
---------------------+------------------------------------------------------
 I would like an example for setting a subset of resolutions using google
 maps.  Here is code which works but is not like a similar example for
 bing.  A working example can be found here:
 http://jsfiddle.net/EVGH6/4/

 function googleTilesWithASubsetOfResolutionsExample()
 {
     var proj900913 = new OpenLayers.Projection( "EPSG:900913" );
 //Spherical mercator used for google maps
     var vegasAirport = new OpenLayers.Bounds ( -12821203.157925,
 4310035.6046593, -12815126.414177, 4314851.1374406 );

     var options = {
         maxExtent: vegasAirport.clone(),
         restrictedExtent : vegasAirport.clone (),
         projection : proj900913,
         displayProjection: proj900913,
         units : "m",
         controls: [new OpenLayers.Control.PanZoomBar ()]
     };

     var map = new OpenLayers.Map( 'map', options );
     var gmap = new OpenLayers.Layer.Google("gmap",  { MIN_ZOOM_LEVEL: 15,
 MAX_ZOOM_LEVEL: 18 } );
     gmap.RESOLUTIONS = gmap.RESOLUTIONS.slice( gmap.MIN_ZOOM_LEVEL,
 gmap.MAX_ZOOM_LEVEL );

     gmap.maxExtent = vegasAirport.clone();
     map.addLayers( [gmap] );
     gmap.resolutions = gmap.RESOLUTIONS;

     map.zoomToExtent( vegasAirport.clone() );

     window.olMap = map;

 }

 Would be nice to have this for all layer types if different types require
 different setup.  Underlying issues seems to be that
 SphericalMercator.initMercatorParameters ignores MIN_ZOOM_LEVEL.

-- 
Ticket URL: <http://trac.openlayers.org/ticket/3626>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list