I have created a small slippy map (Leaflet) and have given it a bounding box. If the user tries to pan/slide outside the given bounds then the map bounces back. Also, the slippy map only has tiles within the bounds so if the user pans out it will all be grey area only. All this is what I want but my question is, in the browser console I get " GET: "file location" net::ERR_FILE_NOT_FOUND" which is expected as I don't have those tiles outside of the map bounds.

So my questions are:

  • What are some slippy map good practices?
  • Should I include tiles outside of the bounding box even though they will not be used?
  • Are these GET errors bad for performance?
  • Is there a way to not get these GET errors and if so how?
  • Is this ok?

Using Leaflet API.


"File not found" responses for missing tiles are normal, there are no tiles anyway. To get rid of those try giving bounds to L.TileLayer object, not to L.Map.

Leaflet will show a gray (or white) background for missing tiles. If you need to visually enforce the absence of tiles, use errorTileUrl option of the L.TileLayer object.

| improve this answer | |

Should I include tiles outside of the bounding box even though they will not be used?

You could use a grayscale basemap outside of the area of interest, to reinforce visually that your application only contains data within a specified area, while still allowing people to navigate anywhere.

| improve this answer | |
  • Thanks for the quick response but it is important for me to restrict the user to the map bounds since I do not want to stress the server by possibly having people requesting/looking at areas of the map that are outside the bounds. My map tiles equal about 1MB in total so the map is pretty small. – Enrique Mar 31 '14 at 1:46

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