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:
@@ -31,15 +31,7 @@
|
|||||||
20037508.34, 20037508.34)
|
20037508.34, 20037508.34)
|
||||||
};
|
};
|
||||||
map = new OpenLayers.Map('map', options);
|
map = new OpenLayers.Map('map', options);
|
||||||
var mapnik = new OpenLayers.Layer.TMS(
|
var mapnik = new OpenLayers.Layer.OSM("OpenStreetMap (Mapnik)");
|
||||||
"OpenStreetMap (Mapnik)",
|
|
||||||
"http://tile.openstreetmap.org/",
|
|
||||||
{
|
|
||||||
type: 'png', getURL: osm_getTileURL,
|
|
||||||
displayOutsideMaxExtent: true,
|
|
||||||
attribution: '<a href="http://www.openstreetmap.org/">OpenStreetMap</a>'
|
|
||||||
}
|
|
||||||
);
|
|
||||||
var gmap = new OpenLayers.Layer.Google("Google", {sphericalMercator:true});
|
var gmap = new OpenLayers.Layer.Google("Google", {sphericalMercator:true});
|
||||||
var sundials = new OpenLayers.Layer.Vector("KML", {
|
var sundials = new OpenLayers.Layer.Vector("KML", {
|
||||||
projection: map.displayProjection,
|
projection: map.displayProjection,
|
||||||
@@ -96,20 +88,6 @@
|
|||||||
delete feature.popup;
|
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>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body onload="init()">
|
<body onload="init()">
|
||||||
|
|||||||
Reference in New Issue
Block a user