TileSourceOptions Object

Note

Bing Maps Web Control SDK retirement

Bing Maps Web Control SDK is deprecated and will be retired. Free (Basic) account customers can continue to use Bing Maps Web Control SDK until June 30th, 2025. Enterprise account customers can continue to use Bing Maps Web Control SDK until June 30th, 2028. To avoid service disruptions, all implementations using Bing Maps Web Control SDK will need to be updated to use Azure Maps Web SDK by the retirement date that applies to your Bing Maps for Enterprise account type. 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.

The following is a list of option properties that can be used with a TileSource.

Name Type Description
bounds LocationRect A bounding box that specifies where tiles are available.

Note: This will not crop tiles to the specific bounding box, it limits the tiles it loads to those that intersect this bounding box.
maxZoom number The maximum zoom level tiles that tiles should be rendered at.
minZoom number The minimum zoom level tiles that tiles should be rendered at.
uriConstructor string or function(PyramidTileId): string Required. This can be a string or a callback function that constructs the URLs used to retrieve tiles from the tile source. When using a string, the uriConstructor will allow you to specify placeholders that will be replaced with the tiles value (i.e. {quadkey}). See the Tile URL Parameters section for a list of supported parameters.

Besides using formatted tile URLs, you can also specify a callback function as the uriConstructor. This is useful if you need to be able to build custom tile URLs that may require some additional calculations for a tile.

Note: When rendered on a high DPI screen such as a mobile device, the map may request tiles from a higher zoom level and scale them down to increase the DPI of your tile layer and create a crisper image.

Tip: Setting the bounds, minZoom and maxZoom of a tile source is useful if you only have tiles available in a specific area, as this will prevent tiles for outside of that area from being requested. This will result in less requests being made to your tile server for tiles that don't exist or are not needed.

Tile URL Parameters

The following is a list of all the possible tile URL parameters that are supported by the TileSource class and can be in the uriConstructor URL.

URL Parameter Description
{x} X position of tile. Tile URL usually also needs {y} and {zoom}.
{y} Y position of tile. Tile URL usually also needs {x} and {zoom}.
{zoom} Zoom level of tile. Tile URL usually also needs {x} and {y}.
{quadkey} Tile quadkey id.
{subdomain} Used to specify a sub-domain. Provides a number between 0 and 3.
{mkt} The culture of the map.
{ur} The user region setting of the map.
{bbox} A bounding box string with the format "{west},{south},{east},{north}". This is useful when working with WMS imagery services.