Hi,
the OSM map class deals wrong with situations where the wrapDateLine,
displayOutsideMaxExtent properties are set to true. It tries to load
the tiles, but with nonsense URLs, i.e. outside the OSM spec range.
The correct thing (that we use) should be

OpenLayers.Layer.OSMMod = OpenLayers.Class(OpenLayers.Layer.OSM, {
    name: "OpenStreetMap",
    attribution: "Data CC-By-SA by <a href='http://openstreetmap.org/'
target='_blank'>OpenStreetMap</a>",
    sphericalMercator: true,
    url: 'http://tile.openstreetmap.org/${z}/${x}/${y}.png',
    getURL: function (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() + this.zoomOffset;

        var z_mod = Math.pow(2, z);
        while (x < 0) {
            x += z_mod;
        }
        while (y < 0) {
            y += z_mod;
        }
        while (x >= z_mod) {
            x -= z_mod;
        }
        while (y >= z_mod) {
            y -= z_mod;
        }

        var url = this.url;
        var s = '' + x + y + z;
        if (url instanceof Array)
        {
            url = this.selectUrl(s, url);
        }

        var path = OpenLayers.String.format(url, {'x': x, 'y': y, 'z': z});

        return path;
    },
     CLASS_NAME: "OpenLayers.Layer.OSM"
});

I've noticed that the ways for handling tile URLs change at the dev OL
version, but still without the corrections above.

M.

-- 
Martin Saturka
Software Engineer, Sourcefabric
www.sourcefabric.org
_______________________________________________
Dev mailing list
d...@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-dev

Reply via email to