# Lat, Lon values from the tile's x, y values?

**URL:** <https://community.cesium.com/t/lat-lon-values-from-the-tiles-x-y-values/21474>\
**Category:** CesiumJS\
**Created:** [December 7, 2022, 7:43am UTC](https://community.cesium.com/t/lat-lon-values-from-the-tiles-x-y-values/21474 "2022-12-07T07:43:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SeYeon](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/seyeon/32/3476_2.png) [@SeYeon](https://community.cesium.com/u/SeYeon)\
**Post date:** [December 7, 2022, 7:43am UTC](https://community.cesium.com/t/lat-lon-values-from-the-tiles-x-y-values/21474/1 "2022-12-07T07:43:36Z")

</div>

I posted a while ago and found out a little later that the way I asked the question was wrong.

//correct the latitude to go from 0 (north) to 180 (south),  
// instead of 90(north) to -90(south)  
latitude=90-latitude;  
//correct the longitude to go from 0 to 360  
longitude=180+longitude;

//find tile size from zoom level  
double latTileSize=180/(pow(2,(17-zoom)));  
double longTileSize=360/(pow(2,(17-zoom)));

//find the tile coordinates  
int tilex=(int)(longitude/longTileSize);  
int tiley=(int)(latitude/latTileSize);

Currently, Google, Bingmap, and OSM have a common method of calculating X and Y from latitude and longitude, and this is described.

ImageryProvider: new Cesium.TileCoordinatesImageryProvider();

shows that when checking the x,y coordinates arranged for each grid of Cesium, the value of tile.x, tile.y returned from cesium differs greatly from that of other systems.

[Terrain tiling system / coordinate system - CesiumJS - Cesium Community](https://community.cesium.com/t/terrain-tiling-system-coordinate-system/2725/3)

I’ve referenced posts you’ve answered before, but most of the links either expired or point to something else entirely.  
Is there a separate part for managing these formulas in cesium?  
I wonder how this part is calculated in Cesium.

The code using the formula has the structure of C#, but I am porting it to JS.

---

<div class="post-metadata">

**Author:** ![Gabby\_Getz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gabby_getz/32/7838_2.png) [@Gabby\_Getz](https://community.cesium.com/u/Gabby_Getz)\
**Post date:** [December 9, 2022, 2:11pm UTC](https://community.cesium.com/t/lat-lon-values-from-the-tiles-x-y-values/21474/2 "2022-12-09T14:11:00Z")

</div>

Hi SeYeon,

We support several image provides, some of which use the typical Web Mercator scheme that I think your referring to here.

[`TileCoordinatesImageryProvider`](https://cesium.com/learn/cesiumjs/ref-doc/TileCoordinatesImageryProvider.html) is a overlay which is mostly used for debug purposes.

You can change the tiling scheme rendering by passing in an alternative TilingScheme as one of the [constructor options](https://cesium.com/learn/cesiumjs/ref-doc/TileCoordinatesImageryProvider.html#.ConstructorOptions):

```auto
const imageryProvider = new Cesium.TileCoordinatesImageryProvider({
      tilingScheme: new Cesium.WebMercatorTilingScheme()
    });

```
