Share via


Tile Calculations

Note

Bing Maps Web Control SDK retirement

Bing Maps Web Control SDK is deprecated and has been retired for all free (Basic) account customers. Enterprise account customers can continue to use Bing Maps Web Control SDK until June 30th, 2028. To avoid service disruptions, all enterprise account customers using Bing Maps Web Control SDK will need to be updated to use Azure Maps Web SDK by June 30th, 2028. For detailed migration guidance, see Migrate from Bing Maps Web Control SDK and Migrate Bing Maps Enterprise applications to Azure Maps with GitHub Copilot.

Azure Maps is Microsoft's next-generation maps and geospatial services for developers. Azure Maps has many of the same features as Bing Maps for Enterprise, and more. To get started with Azure Maps, create a free Azure subscription and an Azure Maps account. For more information about azure Maps, see Azure Maps Documentation. For migration guidance, see Bing Maps Migration Overview.

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.