Dear Tomas,

Have you tried the Peter's solution?

If it doesn't work you could try with a my implementation that work in my
JSPs on Tomcat application.

-------------> BEGIN

map = new OpenLayers.Map("ais_map", map_options);
var mapnik = new OpenLayers.Layer.OSM(
             "TestLayer",                                                 
             "./tiles/openstreetmap/", 
             {
                'type' : 'png',
                'getURL' : get_my_url //NAME OF A JAVASCRIPT FUNCTION
             });
map.addLayer(mapnik);

...
...
...

function get_my_url(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 path = "test/" + z + "/" + x + "/" + y + "." + this.type;
        var url = this.url;
        if (url instanceof Array) {
                url = this.selectUrl(path, url);
        }
        return url + path;
}

<------------- END

In my case the tiles (with "z/x/y" structure) are under a project subfolder
(./tiles/openstreetmap/test/z/x/y.png).

In any case is important to identify, for example with firebug, which are
the tiles that javascript code tries to download.

Regards

Mario Danelli





_______________________________________________
dev mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/dev

Reply via email to