[OpenLayers-Users] Layer.XYZ wrong direction

Paul Meems bontepaarden at gmail.com
Thu Jun 20 08:25:55 PDT 2013


Hi list,

I've been working on getting a tiled server in my application.
It is a 3rd party server so I cannot change anything.
I already have figured out the the Y direction was wrong.
So I override getURL.
Now it is better, but the top tiles are at the bottom and the bottom ones
at top.

So I'm still doing something wrong, but can't figure out what.

Here's my code, found using Google:
        function get_my_url (bounds) {
            var res = this.map.getResolution();
            var x = Math.round ((bounds.left - this.map.maxExtent.left) /
(res * this.tileSize.w));
            var y = Math.round ((this.map.maxExtent.top - bounds.top) /
(res * this.tileSize.h));
            var z = this.map.getZoom();

            if (x<0 || y<0 || z < 0) return;

            var path = z + "/" + x + "/" + y + "." + this.type;
            var url = this.url;
            if (url instanceof Array) {
                url = this.selectUrl(path, url);
            }
            return url + path;

        }

I am getting the correct tiles but they are positions wrong (just in the Y
direction)

Any help is much appreciated.

Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130620/64d6ce20/attachment.html>


More information about the Users mailing list