I've got 2 layers(for indoor and outdoor) in my web application. If i zoom beyond 19, the indoor layer should be displayed and the outdoor layer tiles will be scaled up, because their maxzoom is 19. This works fine with this js-code:

map = L.map('full-map');
tileLayer = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    maxZoom: 23,
    maxNativeZoom: 19

var indoorLayer = L.tileLayer("http://" + SERVER_IP + ":8002/tiles/" + 0 + "/{z}/{x}/{y}.png", {
    minZoom: 20,
    maxZoom: 23

Except this is how it looks when i add the indoor layer to the map: enter image description here What makes me wonder is how some outdoor tiles are still displayed.

It works perfectly if i don't add the indoor layer to the map: enter image description here


Welcome to GIS Stack Exchange!

It could be that your indoor tile layer has no tiles to serve outside your building area. So Leaflet receives a 404 error and displays the Error Tile instead (or a grey tile if not specified), therefore covering the outdoor tiles.

You could set up a transparent tile and define its URL in errorTileUrl Tile Layer option, or use the L.Util.emptyImageUrl in that option:

var indoorLayer = L.tileLayer(
    "http://" + SERVER_IP + ":8002/tiles/" + 0 + "/{z}/{x}/{y}.png", {
    minZoom: 20,
    maxZoom: 23,
    errorTileUrl: L.Util.emptyImageUrl
| improve this answer | |
  • Thanks for the fast answer! This seems logical, the only outdoor tiles that are displayed are in range of the tiles we got for our indoor map. These tiles are transparent. I hoped the not existing tiles are just not displayed. I've added the option, but unfortunately it doesn't work. – Agreon Dec 3 '15 at 12:31
  • ok we will have to dig further then… – ghybs Dec 3 '15 at 12:34
  • you were right with your assumption, i've set the opacity of the indoor map to 0.5: postimg.org/image/9gwa1m3t9 – Agreon Dec 3 '15 at 12:38
  • Strange as actually you were also right: when tile is missing, it should just display nothing, so it should not cover the outdoor tiles… :-S jsfiddle.net/ve2huzxw/75 – ghybs Dec 3 '15 at 12:43
  • Any chance your server actually sends a grey tile on requests outside the tiles it knows? – ghybs Dec 3 '15 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.