Openlayers 3: Custom Tiles 512x512 with specific folder structure and uncommon file n

المشرف العام

Administrator
طاقم الإدارة
I would like to use custom tiles of the size 512x512 pixels with a specific folder structure:

"http://localhost/{z}/{x}_{y}_512_512.png"Unfortunately the folder names do not correspond to the common numbering, instead the z-values range from 1-3 with a decreasing resolution and thex- and y-values have pixel values of the former entire picture, such as: 0, 512, 1024.

I thought I can use the OpenLayers XYZ layer but I am getting stuck translating the x- and y- values OL requets into the x- and y-values that the file names require. However, translating the z-values worked by using a dictionary ("zoomSwitch"). Nonetheless, the x- and y-values structure is more complex and I don't know which value correspond to them.

I'd appreciate any ideas to incorporate these tiles.Many thanks

This is my code for the layer:

var tileLayer = new ol.layer.Tile({ source: new ol.source.XYZ({ attributions: [attribution], maxZoom: 8, minZoom: 6, projection: ol.proj.get('EPSG:3857'), tileSize: 512 tileUrlFunction: function(tileCoord) { globalTileCoord = tileCoord; return urlTemplate.replace('{z}', function (x) {return zoomSwitch[tileCoord[0]].toString()} //.replace('{x}', tileCoord[1].toString()) //.replace('{y}', (-tileCoord[2] - 1).toString()) ;}, wrapX: true }) });The dictionary for the z-value translation is:

zoomSwitch = {6: 3, 7: 2, 8: 1}

أكثر...
 
أعلى