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

3889
1
Jump to solution
07-29-2014 09:22 AM
RobertWinterbottom
Occasional Contributor

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.

0 Kudos
1 Solution

Accepted Solutions
RobertWinterbottom
Occasional Contributor

Ok never mind the question, I started messing with some of the tiled layer functions and finally made it work.  Looks like calling this.onLoad(this) after I updated the initial and fullExtent caused the layer to reset those values and I am now no longer getting 404 errors.

View solution in original post

0 Kudos
1 Reply
RobertWinterbottom
Occasional Contributor

Ok never mind the question, I started messing with some of the tiled layer functions and finally made it work.  Looks like calling this.onLoad(this) after I updated the initial and fullExtent caused the layer to reset those values and I am now no longer getting 404 errors.

0 Kudos