Bad requests in Chrome from custom tile layer

1,000 views
Skip to first unread message

Jason Woolard

unread,
May 26, 2012, 8:44:50 AM5/26/12
to leafl...@googlegroups.com
hi all,

What's the best way to deal with bad requests from a custom tile layer in Leaflet? I'm displaying a tms overlay using L.TileLayer but my tiles do not cover the entire base map view so these "missing" tiles return 404 errors in Chrome even though they aren't "missing" - they just don't exist.

I've seen a php fix for this in Google Maps using a custom function but I was just wondering how other folks handle this in Leaflet?

Thanks in advance.

Jason

FunkMonkey33

unread,
May 29, 2012, 8:01:50 PM5/29/12
to Leaflet
I believe the preferred way of dealing with this is to set the Tile
Layer's errorTileUrl property to the location of a generic error
image. The image could be anything (Google's camera with a slash
through it comes to mind), or it could just be blank.

Hope that helps.

aaron

Jason Sanford

unread,
May 29, 2012, 11:19:03 PM5/29/12
to leafl...@googlegroups.com
Hey, maybe we should make the missing tile stand out with a terrible pink color! Oh, wait. OpenLayers.

Jordan B

unread,
Dec 14, 2012, 5:59:15 PM12/14/12
to leafl...@googlegroups.com
I would also like a way to suppress 404 errors in the console. I tried setting maxBounds to the custom map's edges but don't like the functionality; my map is non-square and I'd like to keep the functionality to be able to zoom all the way out. Is there another way to set the URL template so that it doesn't attempt certain values?
        Thanks,
        Jordan

Jordan B

unread,
Jan 14, 2013, 6:53:01 PM1/14/13
to leafl...@googlegroups.com
I was able to fix this with adimitrov's fix from issue 1021:
pull #991:

Yann

unread,
Jun 18, 2013, 7:58:12 AM6/18/13
to leafl...@googlegroups.com
Hi !

Did you get this solved ?
I can't find a solution for this problem.

I use Cloudmade (maxZoom 18) and custom tiles (maxZoom 22) on top.

I get a lot of 404 errors on Chrome Console even after setting errorTileUrl.

Would be nice not getting those errors if errorTileUrl is set at least...

Hope I can get some help,

Jordan Balagot

unread,
Jun 18, 2013, 3:54:40 PM6/18/13
to leafl...@googlegroups.com
Hi Yann,
          I believe bounds is now implemented in leaflet-master, you can set the bounds with something like:
var southWest = new L.LatLng(-200, 0);
var northEast = new L.LatLng(0, 200);
var bounds = new L.LatLngBounds(southWest, northEast);
And then include {bounds:bounds} in your map initialization.


--
 
---
You received this message because you are subscribed to a topic in the Google Groups "Leaflet" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/leaflet-js/1wKwbulbIFA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to leaflet-js+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Yann

unread,
Jul 25, 2013, 11:52:17 AM7/25/13
to leafl...@googlegroups.com
Hi Jordan,

Thanks for your answer, unfortunately that's not solving my issue.
I don't need to limit the tiles to a region but to a zoom level.
Tiles are available until zoom 18 but I display more precise polygons until zoom 20 so I get 404 errors for the tiles.

Is there a way to limit the tiles to certains zoom level without limiting the map global zoom level ?

Thanks,
Reply all
Reply to author
Forward
0 new messages