2

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!

2
  • A little question for lele3p, what does "floor" stand for, in the formulas above?
    – user55352
    Commented 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. Commented May 1, 2017 at 3:21

1 Answer 1

3

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:

Tiling Schema

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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.