I have local tile also 20 level. I found out that OSM tile level 20 don't loading.
map code:
map = new ol.Map({
target:'map',
renderer:'canvas',
view: new ol.View({
projection: 'EPSG:3857',
center:[2577400.0, 7007400.0],
extent:[2567000.5, 7000400.5, 2588377.0, 7014361.0],
minZoom: 13, maxZoom: 20, zoom:14 })]
})
});
and my osmLayer code:
var osmLayer = new ol.layer.Tile({
source: new ol.source.OSM({
url: '../mapy/a_tiles/{z}/{x}/{y}.png'
})
});
Is there any problem with OSM level 20? In browser devTools I have:
Request URL:http://server/mapy/a_tiles/19/295869/170467.png
Request Method:GET
Status Code:200 OK
despite I just loading 20 level ...
Anybody have any solutions, any ideas?
20-level zoom view:
19-level zoom view:
Answer
The ol.source.OSM() class has a default maxZoom option of 19. If you would like to use zoom level 20, you would have to indicate this explicitly in your OSM layer definition.
In your case you would have to change this
var osmLayer = new ol.layer.Tile({
source: new ol.source.OSM({
url: '../mapy/a_tiles/{z}/{x}/{y}.png'
})
});
to this:
var osmLayer = new ol.layer.Tile({
source: new ol.source.OSM({
maxZoom: 20,
url: '../mapy/a_tiles/{z}/{x}/{y}.png'
})
});


No comments:
Post a Comment