Use an OSM layer instead of TMS with a custom getURL. Non functional change.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10836 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Frédéric Junod
2010-10-15 11:43:53 +00:00
parent 1ce6ce1827
commit 2176013e24

View File

@@ -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()">