Jan-Patrick
Jan-Patrick

Reputation: 13

Leaflet and shifted tiles when loading from a server and not local

That's a first to me, asking a question because I can't find an answer.

My problem is strange. I made a map with my own tile servers. Local everything is fine. But after uploading the tiles to a server strange things happen.

Screenshot of Shifted tiles

The tiles are loaded, but then are duplicated and shifted, but not all, Bahn 5 is fine.

See yourself: http://s521441731.online.de/map/leaflet.html#

Upvotes: 1

Views: 191

Answers (2)

Jan-Patrick
Jan-Patrick

Reputation: 13

Yes black tiles removes the bug, there are black tiles everywhere except where there are real tiles

black tiles + real tiles

So it is a serversided problem, thank you very much

Upvotes: 0

IvanSanchez
IvanSanchez

Reputation: 19089

Judging from my web browser's network tab, it seems that some of the tile requests are being redirected, because the web server is thinking that the user made a typo in the URL:

Screenshot of network tab in developer's tools

In there, when my browser is requesting the /16/34058/43768.png image, the webserver is issuing a 301 HTTP response code, which means "the thing you're looking for is at a different place", and then tells my browser to look at /16/34059/43768.png instead.

Why do I think that this is the web server trying to be too clever for its own good? Because for some other tile requests, it actually replies with:

Screenshot of network tab in developer's tools

I suggest you contact your web server administrators, or else that you have a look at the configuration for the Apache webserver you're hosting your tiles at, particularly anything related to mod_rewrite. Be aware that, in some scenarios, you might be able to override the default Apache configuration by means of .htaccess files, as shown here. (Try setting the RewriteEngine options to off, maybe that'll just work)

If you are using Leaflet (or OpenLayers, or any other similar map display library), HTTP requests for non-existing tiles shall return a 404 HTTP code.

Upvotes: 3

Related Questions