New to Telerik Reporting? Download free 30-day trial

Tile Providers

Tile Providers

The TileProvider class is used to request and download the imagery data for the specified map extent. The imagery data is downloaded on a small images called tiles that form a background image, which can be used to give a better appearance of your map charts. The tile provider should have a valid set of URLs to request the tiles, set directly or through a URL Template. The Map control offers two types of tile providers - BingMapsTileProvider and GenericTileProvider.

  • The BingMapsTileProvider uses Bing Maps REST Services to request metadata information, needed to resolve the tile requests URLs, zoom levels, tile sizes and attribution information such as text and logo that will be displayed on the map. That's why the user doesn't need to provide any server URL, subdomains or another tiles-related information - it is all retrieved automatically from the imagery metadata according to the desired imagery set. BingMapsTileProvider provides three types of imagery sets: Aerial, Road or Aerial with Labels (an Aerial imagery with a road overlay) that are mapped to the predefined values of the ImagerySet property (Aerial, Road, Hybrid). Changing the imagery set causes the BingTileProvider to request images from a different tile set, thus changing the look of the map. The tile server requires a client token for authentication, named Bing Maps Key, that could be obtained from Bing Maps website.

  • The GenericTileProvider requires the user to provide more information - a template to the server URL, the subdomain names (when needed), the application user agent, the attribution text and the URL to the map provider logo should be manually set. The GenericTileProvider is designed in compliance with the Web Map Tile Service - a protocol that defines a standard way of requesting and receiving pre-rendered map tiles. It works with the most common tile size (256 x 256 px) and uses popular mathematical algorithms to calculate and process the results. This provider can be setup to show tiles from most of the current tile providers - OpenStreetMap, HERE Maps, Yandex Maps and many others, since they comply with the WMTS protocol. The provider requires a UrlTemplate and UrlSubdomains to construct the tile requests URL. If the combination of UrlTemplate and UrlSubdomains result in an invalid URI or a tile cannot be retrieved from the tile server for some reason, the map will display a substitute tile containing the exception message. The UrlTemplate includes the tags {subdomain}, {zoom}, {x} and {y} and has the following format: http://{subdomain}{zoom}/{x}/{y}.png". The format tags are case insensitive and can be placed in any order. The mandatory ones are {zoom}, {x} and {y}, because they uniquely define a tile position on a tile set. The {subdomain} tag marks the place where a subdomain from the UrlSubdomains collection (explained below) would be placed. This tag is not mandatory, since the selected tile provider may not offer more than one subdomain. The {zoom} tag will be replaced by the calculated zoom level (level of details) of the current tile set. The level of details depends on the map extent and on the map control size. When the processing engine calculates the appropriate zoom level, its value will replace the {zoom} tag. The {x} and {y} tags are used as a placeholders for the tile position. Before starting to fetch the tiles for the requested map extent, the processing engine will calculate the zoom level and the coordinates of the tiles used to display the extent. When constructing the request, the {x} and {y} tags will be replaced by the calculated X and Y tile coordinates. The image extension (.jpg in the example above) is not mandatory and the provider defines whether to include it or not. Some tile providers do not require an image extension to be requested, while others return the tiles in the same format, regardless of the requested extension. The UrlSubdomains property is a collection of strings, representing the subdomains that will be used to construct the tile URLs. For example, the OpenStreetMap subdomains are: a, b, c. When the processing engine calculates how many tiles will be needed for the requested map extent, it will distribute the web requests evenly among the subdomains for an additional performance gain. In some scenarios it's required to set a value of the UserAgent web request header, which is sent to the tile providing web services. In this case the property UserAgent must be populated with a constant string or an expression that will be evaluated during the report processing. The value of this property will be set as value of the UserAgent web request header. Initially the value of the UserAgent property will be set to a newly generated GUID, but it should be replaced with a correct value according to the tile provider's usage policy. The users should also provide an Attribution text and a LogoUrl that will be used to display an attribution information on the map. The Attribution property must be set manually according to the tile provider usage policy. This text will be displayed in the lower right corner of the map area. The LogoUrl property denotes the URL used to download the tile provider logo, if required by the provider's usage policy. In case the URL points to a valid image, it will be displayed in the lower left corner of the map area.

  • MapQuestTileProvider (obsolete) - uses the MapQuest tile servers that provides the tiles in two imagery sets: OpenStreetMap Tiles and the MapQuest Open Aerial Tiles. The tile server does not require a Client Token for authentication. The MapQuestTileProvider is being substituted by the GenericTileProvider in order to give more control over the tile provider settings and avoid the pre-setup provider configuration.

See Also

In this article