I have url for XYZ source tiles. But there are file names like:
/1/1-0.jpg, --> {z}/{x}-{y}.jpg
There is old code for ol2 transform url.
MyClass = OpenLayers.Class(OpenLayers.Layer.XYZ, {
getURL: function (bounds) {
var xyz = this.getXYZ(bounds);
/... code .../
var textY = xyz.y.toString(2);
while (textY.length < xyz.z) textY = '0' + textY;
for (var i = 6; i < xyz.z; i++)
path += textY.substr(0,i-5) + '-' + textX.substr(0,i-5) + '/';
path += textY + '-' + textX + '.jpg';
return path;
},
CLASS_NAME: "MyClass"
It is possible to make it in ol3?
Best Answer
In
ol.source.XYZ
there is atileUrlFunction
parameter (API TileUrlFunctionType) that should be what you are looking for: