AnsweredAssumed Answered

How can I prevent 404 errors for a custom Tiled Layer using multiple tile sets hosted on S3

Question asked by RWinter85 on Jul 29, 2014
Latest reply on Jul 29, 2014 by RWinter85

Hi All,


My project manager has set up some tiles on a S3 server for me.  There are several sets of tiles (will be 9 when processing is done), that I want to be able to show.  I have wrote a custom tiled layer and overridden the getTileUrl method and that part works great, it can fetch all the tiles it needs correctly and I have also added a property to the layer that I can set to alter the url in getTileUrl to switch between the various sets of tiles which also works fine.


The issue I am having is that it is requesting tiles that the tile sets don't have resulting in 404 errors, it shows them all correctly and I'm not losing any functionality but my console is littered with these 404 errors.  I have found that setting the initial extent to one of the tile set's extents will stop this from happening by only requesting tiles that set has, but this only applies to that specific set of tiles so when I switch to another set of tiles, the tiles won't even load because they are outside of that initial extent.


I have tried resetting the initial extent and full extent via a helper method on the layer, I can see updated json but the layer still seems to use the original extent provided.


Is there a way to update this extent value after the layer has been created ? or is there a good solution to prevent these 404's from showing in the console or even a way to prevent the request for a tile that is not part of the tile set from going out? (I was trying to avoid having to create separate layers for each tile set or have some massive lookup to know the min and max rows and columns per level for each set)


As mentioned, the tiles load, no functionality is lost, just lots of 404 not founds in the console of trying to request tiles that don't exist.