Calculate png tiles around a tile(s)

Hi All

I’m sure this must have been asked a zillion times on here but I don’t seem to be able to find the answer

I have successfully used the formula to calculate a png tile from a lat/long

How do I now calculate the eight tiles around that and then the sixteen around those

Thanks in advance

Here is a starting point:


Thanks for the reply

I’m not sure how that helps me … unless I am missing the bleedin’ obvious ? :smiley:

The tiles are numbered sequentially starting from 0 at the west and north according to this. It should be as easy as incrementing and decrementing the x and y by 1 to find the adjacent tiles. For the 16 tiles, you’d increment and decrement by 2.

Thanks penny dropped. It was a long day

I had thought it was (which is clearly wrong)


When it is obviously