Tile Calculations

A set of methods that perform spatial calculations based on the Tile pyramid used by Bing Maps as defined here. These static methods are exposed through the Microsoft.Maps.SpatialMath.Tiles namespace.

Name Return Type Description
mapSize(zoom: number) number Calculates the full width of the map in pixels at a specific zoom level from -180 degrees to 180 degrees.
groundResolution(latitude: number, zoom: number, units?: DistanceUnits) number Calculates the ground resolution at a specific degree of latitude in the specified units per pixel.
globalPixelToLocation(point: Point, zoom: number) Location Converts a pixel coordinate into a geospatial coordinate at a specified zoom level. Global Pixel coordinates are relative to the top left corner of the map (90, -180).
locationToGlobalPixel(loc: Location, zoom: number) Point Converts a point from latitude/longitude WGS-84 coordinates (in degrees) into pixel XY coordinates at a specified level of detail.
globalPixelToTile(pixel: Point, zoom: number) PyramidTileId Calculates the PyramidTileId that a global pixel intersects with at a specific zoom level.
tileToGlobalPixel(tile: PyramidTileId) Point Converts the upper-left corner of a PyramidTileId into a global pixel coordinate.
locationToTile(loc: Location, zoom: number) PyramidTileId Calculates the PyramidTileId that a Location object intersects with at a specific zoom level.
getTilesInBounds(bounds: LocationRect, zoom: number) PyramidTileId[] Calculates all the PyramidTileId's that are within a LocationRect at a specific zoom level.
tileToLocationRect(tile: PyramidTileId) LocationRect Calculates the LocationRect of a PyramidTileId.