0

What does n mean in this formula: n = pow(2, zoom)? I using this when I calculate tiles.

nmtoken
  • 13,355
  • 5
  • 38
  • 87
user1518183
  • 173
  • 1
  • 2
  • 2
    Please provide more context to your question, including which programming language, application, or software you are using. – Aaron Dec 06 '12 at 17:57
  • Sorry, I forgot it. I using PHP. – user1518183 Dec 06 '12 at 17:59
  • Yes, but where did the formula come from? The answers you are getting are all guesses because we don't have enough information to go on. If you cannot supply any more information, this question will have to be closed as unanswerable. – whuber Dec 07 '12 at 20:27

5 Answers5

5

'n' is almost always used to denote the number of items in a dataset (ie the number of people who participated in a survey or the number of animals counted). I would venture to guess that in this case it represents the number of tiles present at a given zoom level.

However, without more information about precisely what you are trying to accomplish it is difficult to be more specific or accurate.

Kevin
  • 4,926
  • 2
  • 26
  • 50
3

In php and many other languages the pow(a,b) or power(a,b) function raises a to the b power, or multiples a by itself b times. pow(2,3) equals 8.

In your case the higher the zoom level the larger N is.

mhoran_psprep
  • 1,001
  • 1
  • 6
  • 9
3

I think it's the number of tiles. its value is calculated by powers of two. For example, when zoom level is 0, n = 1, when zoom level is 1, n = 2, when zoom level is 2, you get 4 titles, and so on. That means when map is zoomed in larger, map is divided by more tiles.

Charlotte
  • 91
  • 1
2

As already said in other answers, it seems that the equation gives an estimation of the number of tiles for each zoom level. But there is, in my opinion, an important issue.

The equation is valid in scenarios where the set of map resolutions match the sequence R, R/2, R/4, R/8..., where R is the map resolution corresponding to the zoom level 0. While this scenario is the most common, it is not the only possible. A sequence of map resolutions like R, R/3, R/9, R/27... would be possible, or even any set of numbers sorted in descending order.

In any of these two scenarios the mentioned equation is not valid.

dariapra
  • 2,290
  • 14
  • 11
  • Yes, it's good to point out, that those formulas work only with R, R/2, R/4 scenario. But (as said in my post), number of tiles can be calculated with pow(pow(2, zoom), 2) or pow(2, zoom*2). – user1702401 Dec 07 '12 at 10:24
  • Sorry, I read zoom^2 instead of zoom*2. You are correct. I will delete my previous comment. – whuber Dec 07 '12 at 20:51
1

n shows, how many tiles are in one edge of tileset for given zoom level. Tiles can be addressed by x/y/z "coordinates". n-1 is maximum value of x and y in that zoomlevel.

Probably it's simpler to explain by example:

Total count of tiles in given zoom level is pow(2, zoom*2)

In zoom level 0, there are 1*1 tiles (n=1)

In zoom level 1, there are 2*2 tiles (n=2)

In zoom level 2, there are 4*4 tiles (n=4)

etc

user1702401
  • 2,871
  • 1
  • 18
  • 17