[OpenLayers-Commits] r10836 - trunk/openlayers/examples

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Fri Oct 15 07:43:53 EDT 2010


Author: fredj
Date: 2010-10-15 04:43:53 -0700 (Fri, 15 Oct 2010)
New Revision: 10836

Modified:
   trunk/openlayers/examples/sundials-spherical-mercator.html
Log:
Use an OSM layer instead of TMS with a custom getURL. Non functional change.


Modified: trunk/openlayers/examples/sundials-spherical-mercator.html
===================================================================
--- trunk/openlayers/examples/sundials-spherical-mercator.html	2010-10-14 18:52:19 UTC (rev 10835)
+++ trunk/openlayers/examples/sundials-spherical-mercator.html	2010-10-15 11:43:53 UTC (rev 10836)
@@ -31,15 +31,7 @@
                                                  20037508.34, 20037508.34)
             };
             map = new OpenLayers.Map('map', options);
-            var mapnik = new OpenLayers.Layer.TMS(
-                "OpenStreetMap (Mapnik)",
-                "http://tile.openstreetmap.org/",
-                {
-                    type: 'png', getURL: osm_getTileURL,
-                    displayOutsideMaxExtent: true,
-                    attribution: '<a href="http://www.openstreetmap.org/">OpenStreetMap</a>'
-                }
-            );
+            var mapnik = new OpenLayers.Layer.OSM("OpenStreetMap (Mapnik)");
             var gmap = new OpenLayers.Layer.Google("Google", {sphericalMercator:true});
             var sundials = new OpenLayers.Layer.Vector("KML", {
                 projection: map.displayProjection,
@@ -96,20 +88,6 @@
                 delete feature.popup;
             }
         }
-        function osm_getTileURL(bounds) {
-            var res = this.map.getResolution();
-            var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));
-            var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));
-            var z = this.map.getZoom();
-            var limit = Math.pow(2, z);
-
-            if (y < 0 || y >= limit) {
-                return OpenLayers.Util.getImagesLocation() + "404.png";
-            } else {
-                x = ((x % limit) + limit) % limit;
-                return this.url + z + "/" + x + "/" + y + "." + this.type;
-            }
-        }
     </script>
   </head>
   <body onload="init()">



More information about the Commits mailing list