# Get XY value from TiledMapService Layer Tile

I have an ESRI TiledMapService layer and I have attached an event handler to the TileLoaded. Given the level, row, and column, how can I get the envelop of the tile in map coordinates? I'm using the ESRI Silverlight API...

What I am trying to do: I have a polygon (in the same coordinates of the TiledMapServiceLayer) and I want to examine each tile as it comes in and cut out the pixels of the tile that intersect with the polygon.

Any help would be great!

• A little question for lele3p, what does "floor" stand for, in the formulas above?
– user55352
Jul 17, 2015 at 13:00
• floor is a mathematical method that means strip off the decimals and take the whole number. It's the opposite of ceiling which means strip off the decimals and take the next whole number. May 1, 2017 at 3:21

You need the following information about the TilingSchema:
LOD's
Tile origin
Tile size

With this information, calculate the envelope of a tile is a simple mathematical calculation.
Look at the following picture:

Here’s some math you can use to find any tile:

Column = Floor((Point of interest X – Tile origin X) / (Resolution of Level * TileSize))

and

Row = Floor((Tile origin Y – Point of interest Y) / (Resolution of Level * TileSize))

The opposite:

Point of interest X = Column * Tile Size * Resolution of Level + Tile origin X

and

Point of interest Y = Tile origin Y - Row * Tile Size * Resolution of Level

This is the Upper Left of the tile.
For the Bottom Right:

Bottom Right X = Point of interest X + Tile Size * Resolution of Level

and

Bottom Right Y = Point of interest Y - Tile Size * Resolution of Level

Good luck!