I am a newbie to Openlayers and currently dealing with a problem in setting up a custom tile-map. I have a base tile at zoom = 0 as png which has an extent of 56 by 56 kilometres and a resolution of 218.75 meters. Currently the tile-archive goes down to zoom-level 4. I used the projection in EPSG:25833 in proj4 and displayed the tiles via ol.source.xyz. I defined extent and resolution. However the map is not displayed at the correct coordinates. On loading it jumps to a higher zoom-level than entered and displays a small part of a tile. When zooming out the defined extent is just a small rectangle in the center of the map and coordinates go up to exorbitant numers around this extent.
I searched in stackexchange an in the OL-Apidoc, but could not find my error.
Here is my current code:
proj4.defs('EPSG:25833', '+proj=utm +zone=33 +ellps=WGS84 +datum=WGS84 +units=m +no_defs');
var projection25833 = ol.proj.get("EPSG:25833");
var tileLayer = new ol.layer.Tile({
source: new ol.source.XYZ({
projection: projection25833,
url: "{z}/{x}/{-y}.png",
extent: [364900,5791100,420900,5847100],
tileSize: [256, 256],
minZoom: 0,
maxZoom: 4
})
});
var myView = new ol.View({
projection: projection25833,
extent: [364900,5791100,420900,5847100],
center: [392900, 5819100],
resolution: 218.75,
zoom: 0,
minZoom: 0,
maxZoom: 4
});
var map = new ol.Map({
target: "mapDIV",
layers: [tileLayer],
view: myView
});