-1

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.

closed as too broad by PolyGeo Mar 1 at 20:46

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1

"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.

0

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.

  • 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.