Results 1 to 10 of 22

Thread: Make your maps explorable using the Google Maps API (work in progress)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #15
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,307
    Blog Entries
    9

    Default

    If you start off with an image which is 2^n and divisble by 256 then it works like this. Lets say you have an image 32768 pixels square. Thats 2^15 pixels square and 128 x 256 tiles per side and therefore 128x128 tiles in total for the base layer. The next layer down is normally half in each direction so its 1/4 the number of the base tiles. The next layer down again is then 1/16th of the base and so on.

    So its base tiles x ( 1 + 1/4 + 1/16 + 1/64 ... )

    Wikipedia has a page devoted to just that geometric series -> https://en.wikipedia.org/wiki/1/4_%2..._%2B_%E2%8B%AF and it states that the sum starting at 1/4 becomes 1/3. So the total sum is base tiles x 1.3333

    So for image size of 32768 it is 2^15 pixels so therefore 2^( 15-8 ) tiles which is 2^7 which is 128 as I mentioned earlier. Then you square it so that is 2^( ( 15-8 ) *2 ) or 2^14 which is 16384 tiles for the base layer. So that x 1.33333 = 21845 tiles in total for all the layers give or take a couple because the series cuts off when you get down to the one overall max layer tile.

    On our CWBP zoom maps we use 256 sized tiles as well and a 16384 pixel square sized image.

    So thats 2^( ( 14- 8 )*2 ) * 1.33333 = 2^12 * 1.3333 = 4096 * 1.3333 = 5461 tiles. If I go to my directory and select properties then it says 5595 items but some of those items are the directories themselves containing the tiles since each layer and X & Y are stored in their own directory. But its about right. If you want it exact then you would need to write a program to calculate it.

    And yes I have to upload five and a half thousand images or dirs in a zip file when I update the CWBP zoomy maps !

    But TL/DR, for square image of edge size 2^n pixels, num tiles in total is about 2^( ( n-8 ) *2 ) * 1.3333
    Last edited by Redrobes; 06-03-2017 at 09:47 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •