# Cesium.js How to get each tiles' level?

**URL:** <https://community.cesium.com/t/cesium-js-how-to-get-each-tiles-level/3261>\
**Category:** CesiumJS\
**Created:** [November 3, 2015, 3:16pm UTC](https://community.cesium.com/t/cesium-js-how-to-get-each-tiles-level/3261 "2015-11-03T15:16:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aaron\_Feng](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@Aaron\_Feng](https://community.cesium.com/u/Aaron_Feng)\
**Post date:** [November 3, 2015, 3:16pm UTC](https://community.cesium.com/t/cesium-js-how-to-get-each-tiles-level/3261/1 "2015-11-03T15:16:28Z")

</div>

I am trying to get each tiles’ rectangle and level in current view, and use these information to do some ajax request.

Now I have already got all rectangles through:

```auto
var tileRecangles = [];
var tilesToRender = viewer.scene.globe._surface.tileProvider._tilesToRenderByTextureCount;
    if (Cesium.defined(tilesToRender)) {
        for (var j = 0, len = tilesToRender.length; j < len; j++) {
            var quadTrees = tilesToRender[j];
            if (Cesium.defined(quadTrees)) {
                for (var i = 0; i < quadTrees.length; i++) {
                    tileRecangles.push(quadTrees[i].rectangle);
                }
            }
        }
    }

```

The question is how to get the level for each tiles? [The value in red circles of this screenshot](http://i.stack.imgur.com/gaLSS.png)

[![](https://lh3.googleusercontent.com/-srf0fAaseuQ/VjjPqQYYhDI/AAAAAAAAAOc/H0-Be0AP7-0/s320/Untitled.png)](https://lh3.googleusercontent.com/-srf0fAaseuQ/VjjPqQYYhDI/AAAAAAAAAOc/H0-Be0AP7-0/s1600/Untitled.png)

Thanks.

---

<div class="post-metadata">

**Author:** ![Kevin\_Ring](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/kevin_ring/32/2003_2.png) [@Kevin\_Ring](https://community.cesium.com/u/Kevin_Ring)\
**Post date:** [November 3, 2015, 11:14pm UTC](https://community.cesium.com/t/cesium-js-how-to-get-each-tiles-level/3261/2 "2015-11-03T23:14:18Z")

</div>

Hi Aaron,

In your example, you can get the level from quadTrees[i].level. quadTrees is a bit misnamed, though… those are individual tiles in a quadtree.

You can also simplify it like this:

viewer.scene.globe.\_surface.forEachRenderedTile(function(tile) {

// tile.rectangle and tile.level are available here.

});

Please be aware that you’re depending on implementation details of Cesium with this code, and those details can and will break your code by changing from release to release.

Kevin

---

<div class="post-metadata">

**Author:** ![Aaron\_Feng](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@Aaron\_Feng](https://community.cesium.com/u/Aaron_Feng)\
**Post date:** [November 4, 2015, 12:32am UTC](https://community.cesium.com/t/cesium-js-how-to-get-each-tiles-level/3261/3 "2015-11-04T00:32:44Z")

</div>

Got it. Thank you very much.

---

<div class="post-metadata">

**Author:** ![Aaron\_Feng](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@Aaron\_Feng](https://community.cesium.com/u/Aaron_Feng)\
**Post date:** [November 9, 2015, 4:14pm UTC](https://community.cesium.com/t/cesium-js-how-to-get-each-tiles-level/3261/4 "2015-11-09T16:14:39Z")

</div>

Thank you very much.

---

<div class="post-metadata">

**Author:** ![s.plaenitz](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@s.plaenitz](https://community.cesium.com/u/s.plaenitz)\
**Post date:** [February 17, 2017, 11:20am UTC](https://community.cesium.com/t/cesium-js-how-to-get-each-tiles-level/3261/5 "2017-02-17T11:20:24Z")

</div>

And how i get it in WebMercatorTilingScheme?
