# Get user's current zoom level

**URL:** <https://community.cesium.com/t/get-users-current-zoom-level/3946>\
**Category:** CesiumJS\
**Created:** [April 1, 2016, 6:27pm UTC](https://community.cesium.com/t/get-users-current-zoom-level/3946 "2016-04-01T18:27:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![seyed.ahmad](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@seyed.ahmad](https://community.cesium.com/u/seyed.ahmad)\
**Post date:** [April 1, 2016, 6:27pm UTC](https://community.cesium.com/t/get-users-current-zoom-level/3946/1 "2016-04-01T18:27:18Z")

</div>

I know I can get the user's magnitude to the core of earth, however is there a way to get the current zoom level?

I figure if there's no clustering:  
[https://groups.google.com/forum/#!topic/cesium-dev/\_GTmHu7AWvo](https://groups.google.com/forum/#!topic/cesium-dev/_GTmHu7AWvo)

then I can use the current zoom level to cluster a collection of PointPrimitives myself.

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [April 4, 2016, 2:13pm UTC](https://community.cesium.com/t/get-users-current-zoom-level/3946/2 "2016-04-04T14:13:45Z")

</div>

Hello,

You can get the distance in meters between the camera and the ellipsoid surface like this:

var cameraPosition = viewer.scene.camera.positionWC;  
var ellipsoidPosition = viewer.scene.globe.ellipsoid.scaleToGeodeticSurface(cameraPosition);  
var distance = Cesium.Cartesian3.magnitude(Cesium.Cartesian3.subtract(cameraPosition, ellipsoidPosition, new Cesium.Cartesian3()));

``

Best,

Hannah

---

<div class="post-metadata">

**Author:** ![seyed.ahmad](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@seyed.ahmad](https://community.cesium.com/u/seyed.ahmad)\
**Post date:** [April 4, 2016, 8:04pm UTC](https://community.cesium.com/t/get-users-current-zoom-level/3946/3 "2016-04-04T20:04:28Z")

</div>

Awesome, thanks Hannah

---

<div class="post-metadata">

**Author:** ![dshats](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@dshats](https://community.cesium.com/u/dshats)\
**Post date:** [July 19, 2016, 3:52pm UTC](https://community.cesium.com/t/get-users-current-zoom-level/3946/4 "2016-07-19T15:52:07Z")

</div>

Hello,

The code works great in 3D scene mode, but in SCENE2D return invalid results.  
Should i use different calculation for geting the camera's heigth in this case?  
Finally i want to calculate the map's scale represented in 2D view.

Best Regards,

Dima

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [July 20, 2016, 2:38pm UTC](https://community.cesium.com/t/get-users-current-zoom-level/3946/5 "2016-07-20T14:38:13Z")

</div>

Hello Dima,

The problem you’re seeing may be related to this issue: [https://github.com/AnalyticalGraphicsInc/cesium/issues/3845](https://github.com/AnalyticalGraphicsInc/cesium/issues/3845)

positionWC seems like it might be the incorrect value in 2D. Hopefully we’ll look into this soon.

Best,

Hannah

---

<div class="post-metadata">

**Author:** ![sanglnv.87](https://avatars.discourse-cdn.com/v4/letter/s/a88e57/32.png) [@sanglnv.87](https://community.cesium.com/u/sanglnv.87)\
**Post date:** [July 24, 2017, 4:07am UTC](https://community.cesium.com/t/get-users-current-zoom-level/3946/6 "2017-07-24T04:07:39Z")

</div>

Hi Hannah,

For example, i have the zoom level range from 10 - 18 along with 10:20000m - 18:1000m of distance, so now if the camera is currently on 6000m of height, please help me to compute the zoom level of this height and what algorithm to compute it?

Thanks  
Sang

---

<div class="post-metadata">

**Author:** ![Rachel\_Hwang](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@Rachel\_Hwang](https://community.cesium.com/u/Rachel_Hwang)\
**Post date:** [July 28, 2017, 2:59pm UTC](https://community.cesium.com/t/get-users-current-zoom-level/3946/7 "2017-07-28T14:59:10Z")

</div>

Hi Sang,

See this thread: [https://groups.google.com/forum/?hl=en#!searchin/cesium-dev/zoom$20level|sort:relevance/cesium-dev/QG2EbfMl43k/YII7A7OwBwAJ](https://groups.google.com/forum/?hl=en#!searchin/cesium-dev/zoom%2420level%7Csort:relevance/cesium-dev/QG2EbfMl43k/YII7A7OwBwAJ)

The ImageryLayer API will help you. For instance, you can use maximumLevel and minimumLevel to clamp the zoom levels used.

[http://cesiumjs.org/Cesium/Build/Documentation/ImageryProvider.html?classFilter=imagery](http://cesiumjs.org/Cesium/Build/Documentation/ImageryProvider.html?classFilter=imagery)

hope that helps,

- Rachel
