OpenLayers OpenLayers

Ticket #487: wrap.patch

File wrap.patch, 21.7 kB (added by sderle, 1 year ago)

crschmidt's patch with a typo corrected (r3277)

  • tests/Layer/test_WrapDateLine.html

    old new  
     1<html> 
     2<head> 
     3<script src="../../lib/OpenLayers.js"></script> 
     4  <script type="text/javascript"><!-- 
     5    var isMozilla = (navigator.userAgent.indexOf("compatible") == -1); 
     6    var layer;  
     7 
     8    var name = 'Test Layer'; 
     9    var url = "http://octo.metacarta.com/cgi-bin/mapserv"; 
     10    var params = { map: '/mapdata/vmap_wms.map',  
     11                   layers: 'basic',  
     12                   format: 'image/png'}; 
     13 
     14     
     15    function test_Layer_WrapDateLine_adjustBounds(t) { 
     16        t.plan(10); 
     17        var map = new OpenLayers.Map('map'); 
     18        layer = new OpenLayers.Layer.WMS(name, url, params, {'wrapDateLine':true}); 
     19        map.addLayer(layer); 
     20        map.zoomToMaxExtent(); 
     21        var bounds = layer.adjustBounds(new OpenLayers.Bounds(-270,-90,-180,0)); 
     22        t.ok( bounds.equals(new OpenLayers.Bounds(90,-90,180,0)), "-270,-90,-180,0 wraps to 90,-90,180,0"); 
     23        bounds = layer.adjustBounds(new OpenLayers.Bounds(180,-90,270,0)); 
     24        t.ok( bounds.equals(new OpenLayers.Bounds(-180,-90,-90,0)), "180,-90,270,0 wraps to -180,-90,-90,0"); 
     25        bounds = layer.adjustBounds(new OpenLayers.Bounds(-180,-90,0,0)); 
     26        t.ok( bounds.equals(new OpenLayers.Bounds(-180,-90,0,0)), "-180,-90,0,0 doesn't wrap"); 
     27        bounds = layer.adjustBounds(new OpenLayers.Bounds(-181,-90,-179,0)); 
     28        t.ok( bounds.equals(new OpenLayers.Bounds(-181,-90,-179,0)), "-181,-90,-179,0 doesn't wrap, because it straddles the dateline"); 
     29        bounds = layer.adjustBounds(new OpenLayers.Bounds(-180,-180,-90,-90)); 
     30        t.ok( bounds.equals(new OpenLayers.Bounds(-180,-180,-90,-90)), "-180,-180,-90,-90 doesn't wrap, because we don't wrap lats."); 
     31        layer = new OpenLayers.Layer.WMS(name, url, params); 
     32        map.addLayer(layer); 
     33        var testBounds = null; 
     34        var outBounds = null; 
     35        var testList = [ 
     36          new OpenLayers.Bounds(-270,-90,-180,0), 
     37          new OpenLayers.Bounds(180,-90,270,0), 
     38          new OpenLayers.Bounds(-180,-90,0,0), 
     39          new OpenLayers.Bounds(-181,-90,-179,0), 
     40          new OpenLayers.Bounds(-180,-180,-90,-90), 
     41        ];           
     42        for (var i = 0; i < testList.length; i++) { 
     43            outBounds = layer.adjustBounds(testList[i]); 
     44            t.ok( outBounds.equals(testList[i]), testList[i]+" doesn't wrap in non-wrapping layer."); 
     45        } 
     46    } 
     47    function test_Layer_WrapDateLine_getLonLat(t) { 
     48        t.plan(12); 
     49        var map = new OpenLayers.Map('map'); 
     50        layer = new OpenLayers.Layer.WMS(name, url, params, {'wrapDateLine':true}); 
     51        map.addLayer(layer); 
     52        map.zoomToMaxExtent(); 
     53        var testLonLats = [ 
     54            new OpenLayers.LonLat(-185,5), 
     55            new OpenLayers.LonLat(-180,-95), 
     56            new OpenLayers.LonLat(-180,95), 
     57            new OpenLayers.LonLat(180,-95), 
     58            new OpenLayers.LonLat(180,95), 
     59            new OpenLayers.LonLat(185,5) 
     60        ]; 
     61        var outLonLats = [ 
     62            new OpenLayers.LonLat(175,5), 
     63            new OpenLayers.LonLat(-180,-95), 
     64            new OpenLayers.LonLat(-180,95), 
     65            new OpenLayers.LonLat(180,-95), 
     66            new OpenLayers.LonLat(180,95), 
     67            new OpenLayers.LonLat(-175,5) 
     68        ];     
     69             
     70        for (var i = 0; i < testLonLats.length; i++) { 
     71            var pixel = layer.getViewPortPxFromLonLat(testLonLats[i]); 
     72            var lonlat = layer.getLonLatFromViewPortPx(pixel); 
     73            lonlat.lon = Math.round(lonlat.lon); 
     74            lonlat.lat = Math.round(lonlat.lat); 
     75            t.ok(outLonLats[i].equals(lonlat), testLonLats[i] + " wraps to " + outLonLats[i]+ " (what happened: " + lonlat + ")");    
     76        } 
     77         
     78        layer = new OpenLayers.Layer.WMS(name, url, params); 
     79        map.addLayer(layer); 
     80        var outLonLats = [ 
     81            new OpenLayers.LonLat(-185,5), 
     82            new OpenLayers.LonLat(-180,-95), 
     83            new OpenLayers.LonLat(-180,95), 
     84            new OpenLayers.LonLat(180,-95), 
     85            new OpenLayers.LonLat(180,95), 
     86            new OpenLayers.LonLat(185,5) 
     87        ];     
     88        for (var i = 0; i < testLonLats.length; i++) { 
     89            var pixel = layer.getViewPortPxFromLonLat(testLonLats[i]); 
     90            var lonlat = layer.getLonLatFromViewPortPx(pixel); 
     91            lonlat.lon = Math.round(lonlat.lon); 
     92            lonlat.lat = Math.round(lonlat.lat); 
     93            t.ok(outLonLats[i].equals(lonlat), testLonLats[i] + " wraps to " + outLonLats[i]+ " (what happened: " + lonlat + ")");    
     94        } 
     95         
     96    } 
     97    function test_Layer_WrapDateLine_ZoomToExtent (t) { 
     98        t.plan( 4 ); 
     99 
     100        var url = "http://octo.metacarta.com/cgi-bin/mapserv"; 
     101        layer = new OpenLayers.Layer.WMS(name, url, params, {'wrapDateLine':true}); 
     102        var m = new OpenLayers.Map('map'); 
     103        m.addLayer(layer); 
     104        m.setCenter = function(myCenter) { this.center = myCenter; } 
     105        var testBounds = [ 
     106            new OpenLayers.Bounds(-185,-90,-175,-85), 
     107            new OpenLayers.Bounds(0,-90,-170,-85), 
     108            new OpenLayers.Bounds(-270,-90,-180,-85), 
     109            new OpenLayers.Bounds(0,0,45,45) 
     110        ]; 
     111        var outCenters = [ 
     112            new OpenLayers.LonLat(-180,-87.5), 
     113            new OpenLayers.LonLat(95,-87.5), 
     114            new OpenLayers.LonLat(135,-87.5), 
     115            new OpenLayers.LonLat(22.5,22.5) 
     116        ]; 
     117        for (var i = 0; i < testBounds.length; i++) { 
     118            m.zoomToExtent(testBounds[i]); 
     119            t.ok(m.center.equals(outCenters[i]), "Map center from bounds " + testBounds[i] + " should be " + outCenters[i] + ", got " + m.center);   
     120        } 
     121         
     122     
     123    } 
     124    function test_Layer_WrapDateLine_WMS (t) { 
     125        t.plan( 3 ); 
     126 
     127        var url = "http://octo.metacarta.com/cgi-bin/mapserv"; 
     128        layer = new OpenLayers.Layer.WMS(name, url, params, {'wrapDateLine':true}); 
     129        var m = new OpenLayers.Map('map'); 
     130        m.addLayer(layer); 
     131        m.zoomToMaxExtent(); 
     132        t.eq(layer.grid[3][0].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C-90%2C180%2C90&WIDTH=256&HEIGHT=256", "cell [3][0] is wrapped around the world."); 
     133        t.eq(layer.grid[0][0].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C450%2C180%2C630&WIDTH=256&HEIGHT=256", "cell [0][0] is wrapped around the world lon, but not lat"); 
     134        t.eq(layer.grid[0][3].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-180%2C450%2C0%2C630&WIDTH=256&HEIGHT=256", "cell [3][0] is not wrapped at all."); 
     135 
     136    } 
     137    function test_Layer_WrapDateLine_KaMap (t) { 
     138        t.plan( 3 ); 
     139 
     140        var layer = new OpenLayers.Layer.KaMap( "Blue Marble NG", 
     141             "http://www.openlayers.org/world/index.php", 
     142             {g: "satellite", map: "world"}, 
     143             {wrapDateLine: true} );  
     144        var m = new OpenLayers.Map('map'); 
     145        m.addLayer(layer); 
     146        m.zoomToMaxExtent(); 
     147        t.eq(layer.grid[0][0].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-768&l=0&s=221471921.25", "grid[0][0] kamap is okay"); 
     148        t.eq(layer.grid[0][3].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-768&l=-256&s=221471921.25", "grid[0][3] kamap is okay"); 
     149        t.eq(layer.grid[3][0].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=0&l=0&s=221471921.25", "grid[3][0] is okay"); 
     150    } 
     151    function test_Layer_WrapDateLine_WMS_Overlay (t) { 
     152        t.plan( 3 ); 
     153        var url = "http://octo.metacarta.com/cgi-bin/mapserv"; 
     154        baselayer = new OpenLayers.Layer.WMS(name, url, params, {'wrapDateLine':true}); 
     155        var layer = new OpenLayers.Layer.WMS( "DM Solutions Demo", 
     156            "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap", 
     157            {layers: "bathymetry,land_fn,park,drain_fn,drainage," + 
     158                     "prov_bound,fedlimit,rail,road,popplace", 
     159             transparent: "true", format: "image/png"}, 
     160            {wrapDateLine: true, reproject: false}); 
     161        var m = new OpenLayers.Map('map'); 
     162        m.addLayers([baselayer,layer]); 
     163        m.zoomToMaxExtent(); 
     164        t.eq(layer.grid[0][0].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C450%2C180%2C630&WIDTH=256&HEIGHT=256", "grid[0][0] wms overlay is okay"); 
     165        t.eq(layer.grid[0][3].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-180%2C450%2C0%2C630&WIDTH=256&HEIGHT=256", "grid[0][3] wms overlay is okay"); 
     166        t.eq(layer.grid[3][0].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C-90%2C180%2C90&WIDTH=256&HEIGHT=256", "grid[3][0] wms overlay okay"); 
     167    } 
     168  // --> 
     169  </script> 
     170</head> 
     171<body> 
     172<div id="map" style="width:1000px;height:550px"></div> 
     173</body> 
     174</html> 
  • tests/list-tests.html

    old new  
    4848    <li>Layer/test_TMS.html</li> 
    4949    <li>Layer/test_Vector.html</li> 
    5050    <li>Layer/test_GML.html</li> 
     51    <li>Layer/test_WrapDateLine.html</li> 
    5152    <li>test_Tile.html</li> 
    5253    <li>Tile/test_Image.html</li> 
    5354    <li>test_Control.html</li> 
  • lib/OpenLayers/Layer.js

    old new  
    139139 
    140140    /** @type Boolean */ 
    141141    displayOutsideMaxExtent: false, 
     142 
     143    /** @type @Boolean */ 
     144    wrapDateLine: false, 
    142145     
    143146     
    144147    /** 
     
    165168            this.events = new OpenLayers.Events(this, this.div,  
    166169                                                this.EVENT_TYPES); 
    167170        } 
     171 
     172        if (this.wrapDateLine) this.displayOutsideMaxExtent = true; 
    168173    }, 
    169174     
    170175    /** 
     
    281286            this.maxExtent = this.maxExtent || this.map.maxExtent; 
    282287            this.projection = this.projection || this.map.projection; 
    283288            this.units = this.units || this.map.units; 
    284              
    285289            this.initResolutions(); 
    286290             
    287291            if (!this.isBaseLayer) { 
     
    294298            this.setTileSize(); 
    295299        } 
    296300    }, 
    297    
     301 
    298302    /** 
    299303     * Set the tile size based on the map size.  This also sets layer.imageSize 
    300304     * and layer.imageOffset for use by Tile.Image. 
     
    613617         
    614618                var delta_x = viewPortPx.x - (size.w / 2); 
    615619                var delta_y = viewPortPx.y - (size.h / 2); 
    616              
    617                 lonlat = new OpenLayers.LonLat(center.lon + delta_x * res , 
    618                                              center.lat - delta_y * res);  
     620         
     621                lon = center.lon + delta_x * res;  
     622         
     623                if (this.wrapDateLine) { 
     624                    while (lon < this.maxExtent.left) { // -180 
     625                        lon += (this.maxExtent.right - this.maxExtent.left); // 360 
     626                    }     
     627                    while (lon > this.maxExtent.right) { // 180 
     628                        lon -= (this.maxExtent.right - this.maxExtent.left); // 360 
     629                    }     
     630                } 
     631                 
     632                lonlat = new OpenLayers.LonLat(lon, center.lat - delta_y * res);  
    619633            } // else { DEBUG STATEMENT } 
    620634        } 
    621635        return lonlat; 
     
    681695        this.div.style.zIndex = zIdx; 
    682696    }, 
    683697 
     698    /** 
     699    * This function will take a bounds, and if wrapDateLine option is set 
     700    * on the layer, it will return a bounds which is wrapped around the world. 
     701    * We do not wrap for bounds which *cross* the maxExtent.left/right, only 
     702    * bounds which are entirely to the left or entirely to the right. 
     703    * 
     704    * @param {OpenLayers.Bounds} bounds 
     705    * @private 
     706    */ 
     707    adjustBounds: function (bounds) { 
     708        if (this.wrapDateLine) { 
     709            /* wrap around the date line, within the limits of rounding error */ 
     710            var res = this.getResolution(); 
     711            var width = this.maxExtent.right - this.maxExtent.left; 
     712            while (bounds.left  < this.maxExtent.left + res && 
     713                   bounds.right < this.maxExtent.left + res) { 
     714                bounds = bounds.clone(); 
     715                bounds.left  += width; bounds.right += width; 
     716            }     
     717            while (bounds.left  > this.maxExtent.right - res && 
     718                   bounds.right > this.maxExtent.right - res) { 
     719                bounds = bounds.clone(); 
     720                bounds.left -= width; bounds.right -= width; 
     721            }     
     722        } 
     723        return bounds; 
     724    }, 
     725 
    684726    /** @final @type String */ 
    685727    CLASS_NAME: "OpenLayers.Layer" 
    686728}; 
  • lib/OpenLayers/Map.js

    old new  
    11141114     * @param {OpenLayers.Bounds} bounds 
    11151115     */ 
    11161116    zoomToExtent: function(bounds) { 
    1117         this.setCenter(bounds.getCenterLonLat(),  
    1118                        this.getZoomForExtent(bounds)); 
     1117        var center = bounds.getCenterLonLat(); 
     1118        if (this.baseLayer.wrapDateLine) { 
     1119            bounds = bounds.clone(); 
     1120            var maxExt = this.getMaxExtent(); 
     1121            var width  = maxExt.right - maxExt.left; 
     1122            while (bounds.right < bounds.left) { 
     1123                bounds.right += width; 
     1124            } 
     1125            center = bounds.getCenterLonLat(); 
     1126            while (center.lon > maxExt.right) { 
     1127                center.lon -= width; 
     1128            } 
     1129            while (center.lon < maxExt.left) { 
     1130                center.lon += width; 
     1131            }     
     1132        } 
     1133        this.setCenter(center, this.getZoomForExtent(bounds)); 
    11191134    }, 
    11201135 
    11211136    /** Zoom to the full extent and recenter. 
  • lib/OpenLayers/Layer/MapServer.js

    old new  
    8787     * @type String 
    8888     */ 
    8989    getURL: function (bounds) { 
    90         if(this.gutter) { 
    91             bounds = this.adjustBoundsByGutter(bounds); 
    92         } 
     90        bounds = this.adjustBounds(bounds); 
    9391        // Make a list, so that getFullRequestString uses literal ","  
    9492        var extent = [bounds.left, bounds. bottom, bounds.right, bounds.top]; 
    9593         
     
    105103         
    106104        return url; 
    107105    }, 
     106 
     107    /**  
     108     * Subclass of adjustBounds from Layer.js, which adds support for adjusting 
     109     * bounds by a gutter. 
     110     */ 
     111    adustBounds: function(bounds) { 
     112        if(this.gutter) { 
     113            bounds = this.adjustBoundsByGutter(bounds); 
     114        } 
     115        OpenLayers.Layer.Grid.prototype.adjustBounds.apply(this, [bounds]); 
     116    },     
    108117     
    109118    /**  
    110119     * getFullRequestString on MapServer layers is special, because we  
  • lib/OpenLayers/Layer/WMS.js

    old new  
    9393     * @type String 
    9494     */ 
    9595    getURL: function (bounds) { 
    96         if(this.gutter) { 
    97             bounds = this.adjustBoundsByGutter(bounds); 
    98         } 
     96        bounds = this.adjustBounds(bounds); 
    9997        return this.getFullRequestString( 
    10098                     {BBOX:bounds.toBBOX(), 
    10199                      WIDTH:this.imageSize.w, 
    102100                      HEIGHT:this.imageSize.h}); 
    103101    }, 
    104102 
     103    /**  
     104     * Subclass of adjustBounds from Layer.js, which adds support for adjusting 
     105     * bounds by a gutter. 
     106     */ 
     107    adjustBounds: function(bounds) { 
     108        if(this.gutter) { 
     109            bounds = this.adjustBoundsByGutter(bounds); 
     110        } 
     111        OpenLayers.Layer.Grid.prototype.adjustBounds.apply(this, [bounds]); 
     112    },     
     113     
     114 
    105115    /** 
    106116    * addTile creates a tile, initializes it, and  
    107117    * adds it to the layer div.  
  • lib/OpenLayers/Layer/WorldWind.js

    old new  
    6969     * @type String 
    7070     */ 
    7171    getURL: function (bounds) { 
     72        bounds = this.adjustBounds(bounds); 
    7273        var zoom = this.getZoom(); 
    7374        var extent = this.map.getMaxExtent(); 
    7475        var deg = this.lzd/Math.pow(2,this.getZoom()); 
  • lib/OpenLayers/Layer/KaMap.js

    old new  
    4949     * @type String 
    5050     */ 
    5151    getURL: function (bounds) { 
     52        bounds = this.adjustBounds(bounds); 
    5253        var mapRes = this.map.getResolution(); 
    5354        var scale = Math.round((this.map.getScale() * 10000)) / 10000; 
    5455        var pX = Math.round(bounds.left / mapRes); 
  • lib/OpenLayers/Layer/TMS.js

    old new  
    7171     * @type String 
    7272     */ 
    7373    getURL: function (bounds) { 
     74        bounds = this.adjustBounds(bounds); 
    7475        var res = this.map.getResolution(); 
    7576        var x = (bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w); 
    7677        var y = (bounds.bottom - this.tileOrigin.lat) / (res * this.tileSize.h); 
  • examples/lite.html

    old new  
    1818        function init(){ 
    1919            map = new OpenLayers.Map( 'map' ); 
    2020            layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",  
    21                     "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} ); 
     21                    "http://labs.metacarta.com/wms/vmap0", 
     22                    {layers: 'basic'} ); 
    2223            map.addLayer(layer); 
    2324            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); 
    2425        } 
  • examples/wrapDateLine.html

    old new  
     1<html xmlns="http://www.w3.org/1999/xhtml"> 
     2  <head> 
     3    <style type="text/css"> 
     4        #map { 
     5            width: 800px; 
     6            height: 475px; 
     7            border: 1px solid black; 
     8        } 
     9    </style> 
     10    <script src="../lib/OpenLayers.js"></script> 
     11    <script type="text/javascript"> 
     12        <!-- 
     13        var map; 
     14        function init(){ 
     15            map = new OpenLayers.Map( 'map', {maxResolution: 1.40625} ); 
     16            var mapserv = new OpenLayers.Layer.MapServer( "OpenLayers Basic",  
     17                        "http://labs.metacarta.com/wms/vmap0", 
     18                        {layers: 'basic'}, 
     19                        {wrapDateLine: true} ); 
     20                         
     21            var kamap = new OpenLayers.Layer.KaMap( "Blue Marble NG", 
     22                        "http://www.openlayers.org/world/index.php", 
     23                        {g: "satellite", map: "world"}, 
     24                        {wrapDateLine: true} ); 
     25 
     26            var wms = new OpenLayers.Layer.WMS( "DM Solutions Demo", 
     27                "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap", 
     28                {layers: "bathymetry,land_fn,park,drain_fn,drainage," + 
     29                         "prov_bound,fedlimit,rail,road,popplace", 
     30                 transparent: "true", format: "image/png"}, 
     31                {wrapDateLine: true, reproject: false}); 
     32 
     33            /* TMS is broken, too */ 
     34            tms = new OpenLayers.Layer.TMS( "OpenStreetMap",  
     35                    "http://labs.metacarta.com/wms-c/Basic.py/", 
     36                    {layername: 'osm-map', type:'png', wrapDateLine: true} ); 
     37 
     38            /* WW doesn't quite work yet */ 
     39            ww = new OpenLayers.Layer.WorldWind( "LANDSAT", 
     40                    "http://worldwind25.arc.nasa.gov/tile/tile.aspx", 2.25, 4, 
     41                    {T:"105"}, 
     42                    {'maxResolution': .28125, 
     43                     tileSize: new OpenLayers.Size(512, 512), 
     44                     wrapDateLine: true}); 
     45         
     46            map.addLayers([mapserv, kamap, wms]); 
     47            map.addControl(new OpenLayers.Control.LayerSwitcher()); 
     48            map.zoomToMaxExtent(); 
     49        } 
     50        // --> 
     51    </script> 
     52  </head> 
     53  <body onload="init()"> 
     54    <div id="map"></div> 
     55    <div id="docs"> 
     56        This is an example that shows wrapping the date line. Wrapping the  
     57        date line is an option on the layer.   
     58    </div> 
     59  </body> 
     60</html>