New to Telerik UI for WinFormsStart a free 30-day trial

Provides comprehensive map services using Bing Maps REST APIs including tiles, routing, search, elevation, and truck routing capabilities.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.RadMap.dll

Syntax:

C#
public class BingRestMapProvider : IMapProvider, ICloneable, IMapTileProvider, IMapRouteProvider, IMapTruckRouteProvider, IMapSearchProvider, IMapBaseSearchProvider, IMapElevationProvider

Inheritance: objectBingRestMapProvider

Implements: ICloneableIMapBaseSearchProviderIMapElevationProviderIMapProviderIMapRouteProviderIMapSearchProviderIMapTileProviderIMapTruckRouteProvider...

Constructors

Initializes a new instance of the BingRestMapProvider class with default settings and configures tile downloading and caching.

C#
public BingRestMapProvider()

Fields

C#
protected Dictionary<string, List<TileInfo>> cacheLoadReference
C#
protected object lockObj
C#
protected Dictionary<string, TileInfo> tileMatrix

Properties

Gets or sets the Bing Maps API key used for authenticating requests to Bing Maps services and enabling premium features.

C#
public string BingKey { get; set; }
Property Value:

The bing key.

Gets or sets the cache provider instance used for storing and retrieving map tiles from local storage.

C#
public IMapCacheProvider CacheProvider { get; set; }

Implements: IMapTileProvider.CacheProvider

Gets or sets the culture information used for localizing map content, search results, and routing instructions.

C#
public CultureInfo Culture { get; set; }
Property Value:

The culture.

Gets or sets a value indicating whether tile caching is enabled for storing downloaded tiles locally to improve performance.

C#
public bool EnableCaching { get; set; }

Implements: IMapTileProvider.EnableCaching

Gets the unique identifier for this Bing Maps provider instance.

C#
public string Id { get; }

Implements: IMapProvider.Id

ImagerySet

ImagerySet

Gets or sets the Bing Maps imagery set that determines the visual style and content type of map tiles displayed.

C#
public ImagerySet ImagerySet { get; set; }
Property Value:

The imagery set.

Gets or sets a value indicating whether this BingRestMapProvider has completed initialization and is ready for service calls.

C#
public bool Initialized { get; protected set; }
Property Value:

true if initialized; otherwise, false.

Gets or sets a value indicating whether this BingRestMapProvider is currently performing initialization operations.

C#
public bool Initializing { get; protected set; }
Property Value:

true if initializing; otherwise, false.

Gets or sets the maximum zoom level supported by this Bing Maps provider for tile requests and map display.

C#
public int MaxZoomLevel { get; set; }

Implements: IMapProvider.MaxZoomLevel

Gets or sets the minimum zoom level supported by this Bing Maps provider for tile requests and map display.

C#
public int MinZoomLevel { get; set; }

Implements: IMapProvider.MinZoomLevel

Gets the unique session identifier obtained from Bing Maps logging service for optimized API usage and cost reduction.

C#
public string SessionId { get; }
Property Value:

The session identifier.

Gets the settings that control tile rendering behavior.

C#
public MapTileProviderSettings Settings { get; }

Implements: IMapTileProvider.Settings

Gets or sets the tile downloader instance responsible for asynchronously downloading map tiles from Bing Maps service.

C#
public IMapTileDownloader TileDownloader { get; set; }

Implements: IMapTileProvider.TileDownloader

Gets the standard tile size in pixels used by this Bing Maps provider for all tile requests and rendering operations.

C#
public Size TileSize { get; }

Implements: IMapTileProvider.TileSize

Gets or sets a value indicating whether to use session-based authentication for improved performance and reduced transaction costs.

C#
public bool UseSession { get; set; }
Property Value:

true if session should be used; otherwise, false.

Methods

Constructs the Bing Maps elevation request URI based on the elevation request parameters and elevation type settings.

C#
protected virtual Uri BuildElevationRequestUri(ElevationRequest request)
Parameters:requestElevationRequest

The elevation request containing parameters for URI construction.

Returns:

Uri

The complete URI for the Bing Maps elevation API request.

Constructs the Bing Maps routing request URI based on the route request parameters and travel mode settings.

C#
protected virtual Uri BuildRoutingRequestUri(RouteRequest request)
Parameters:requestRouteRequest

The route request containing parameters for URI construction.

Returns:

Uri

The complete URI for the Bing Maps routing API request.

Constructs the Bing Maps search request URI based on the search request parameters and localization settings.

C#
protected virtual Uri BuildSearchRequestUri(SearchRequest request)
Parameters:requestSearchRequest

The search request containing query parameters and search options.

Returns:

Uri

The complete URI for the Bing Maps search API request.

Constructs the JSON request body for truck routing containing waypoints, vehicle specifications, and routing options.

C#
protected virtual string BuildTruckRouteRequestBody(TruckRouteRequest request)
Parameters:requestTruckRouteRequest

The truck route request containing parameters for JSON body construction.

Returns:

string

The JSON request body string for the truck routing API call.

Constructs the Bing Maps truck routing request URI with authentication parameters for the truck routing service.

C#
protected virtual Uri BuildTruckRouteRequestUri(TruckRouteRequest request)
Parameters:requestTruckRouteRequest

The truck route request containing routing parameters.

Returns:

Uri

The complete URI for the Bing Maps truck routing API request.

Performs an asynchronous elevation calculation using Bing Maps elevation services with the specified elevation request parameters.

C#
public void CalculateElevationAsync(ElevationRequest request)
Parameters:requestElevationRequest

The elevation request containing points, bounds, and elevation calculation options.

Implements: IMapElevationProvider.CalculateElevationAsync(ElevationRequest)

Performs an asynchronous route calculation using Bing Maps routing services with the specified route request parameters.

C#
public void CalculateRouteAsync(RouteRequest request)
Parameters:requestRouteRequest

The route request containing waypoints, travel mode, and routing options.

Implements: IMapRouteProvider.CalculateRouteAsync(RouteRequest)

Performs an asynchronous truck route calculation using Bing Maps truck routing services with vehicle specifications and restrictions.

C#
public void CalculateTruckRouteAsync(TruckRouteRequest request)
Parameters:requestTruckRouteRequest

The truck route request containing waypoints, vehicle specifications, and routing constraints.

Implements: IMapTruckRouteProvider.CalculateTruckRouteAsync(TruckRouteRequest)

Creates a deep copy of this BingRestMapProvider instance with all configuration settings and metadata information.

C#
public object Clone()
Returns:

object

A new BingRestMapProvider object that is a copy of this instance.

Implements: ICloneable.Clone()

Generates a unique cache key string for storing and retrieving tile images based on coordinates, zoom level, and imagery set.

C#
protected virtual string GetCacheKey(int tileX, int tileY, int zoomLevel)
Parameters:tileXint

The tile x.

tileYint

The tile y.

zoomLevelint

The zoom level.

Returns:

string

System.String.

Generates map visual elements for the specified viewport by converting cached tile images into renderable map tile elements.

C#
public virtual IEnumerable<MapVisualElement> GetContent(IMapViewport viewport)
Parameters:viewportIMapViewport

The map viewport defining the visible area and zoom level.

Returns:

IEnumerable<MapVisualElement>

An enumerable collection of MapVisualElement objects representing map tiles.

Implements: IMapProvider.GetContent(IMapViewport)

Converts a list of geographic points into a comma-separated string format for use in elevation API requests.

C#
protected virtual string GetPointsString(List<PointG> points)
Parameters:pointsList<PointG>

The list of geographic points to convert.

Returns:

string

A comma-separated string representation of the points in latitude,longitude format.

Retrieves a list of supported map views based on available Bing Maps imagery sets with localized names and selection state.

C#
public virtual List<MapViewInfo> GetSupportedViews()
Returns:

List<MapViewInfo>

A list of MapViewInfo objects representing available Bing Maps imagery sets.

Implements: IMapProvider.GetSupportedViews()

Constructs the URI for retrieving a specific map tile from Bing Maps service using tile matrix coordinates and zoom level.

C#
public Uri GetTile(int tileMatrixX, int tileMatrixY, int zoomLevel)
Parameters:tileMatrixXint

The tile matrix x.

tileMatrixYint

The tile matrix y.

zoomLevelint

The zoom level.

Returns:

Uri

Uri.

Synchronously retrieves a tile image from Bing Maps service or cache using the specified tile matrix coordinates and zoom level.

C#
public Image GetTileImage(int tileMatrixX, int tileMatrixY, int zoomLevel)
Parameters:tileMatrixXint

The tile matrix X coordinate.

tileMatrixYint

The tile matrix Y coordinate.

zoomLevelint

The zoom level for the tile.

Returns:

Image

The tile image, or null if the tile cannot be retrieved.

Implements: IMapTileProvider.GetTileImage(int, int, int)

Retrieves the tile image for the specified TileInfo either from cache or by downloading from Bing Maps service.

C#
protected virtual void GetTileInfoImage(TileInfo tileInfo)
Parameters:tileInfoTileInfo

The tile information.

Initializes this Bing Maps provider by establishing session authentication and retrieving imagery metadata for tile operations.

C#
public virtual void Initialize()
Exceptions:

Exception

Implements: IMapProvider.Initialize()

Handles the completion of imagery metadata initialization by processing service response and configuring tile size and zoom levels.

C#
protected virtual void InitializeImageryMetadataCompleted(object sender, DownloadStringCompletedEventArgs e)
Parameters:senderobject

The sender.

eDownloadStringCompletedEventArgs

The DownloadStringCompletedEventArgs instance containing the event data.

Initializes the Bing Maps imagery service by retrieving metadata information for the current imagery set and configuring tile parameters.

C#
protected virtual void InitializeImageryService()
Exceptions:

Exception

Handles the completion of session initialization by extracting the session ID and proceeding to initialize imagery services.

C#
protected virtual void InitializeSessionCompleted(object sender, DownloadStringCompletedEventArgs e)
Parameters:senderobject

The sender.

eDownloadStringCompletedEventArgs

The DownloadStringCompletedEventArgs instance containing the event data.

Raises the CalculateElevationCompleted event to notify subscribers that an elevation calculation has finished successfully.

C#
protected virtual void OnCalculateElevationCompleted(ElevationCompletedEventArgs e)
Parameters:eElevationCompletedEventArgs

The event arguments containing the calculated elevation data.

Handles the completion of elevation calculation by processing the JSON response and extracting elevation or sea level data.

C#
protected virtual void OnCalculateElevationCompleted(object sender, DownloadStringCompletedEventArgs e)
Parameters:senderobject

The sender.

eDownloadStringCompletedEventArgs

The DownloadStringCompletedEventArgs instance containing the event data.

Raises the CalculateElevationError event to notify subscribers that an elevation calculation has encountered an error.

C#
protected virtual void OnCalculateElevationError(CalculateElevationErrorEventArgs e)
Parameters:eCalculateElevationErrorEventArgs

The event arguments containing the elevation calculation error details.

Handles the completion of route calculation by processing the JSON response and extracting route information.

C#
protected virtual void OnCalculateRouteCompleted(object sender, DownloadStringCompletedEventArgs e)
Parameters:senderobject

The sender.

eDownloadStringCompletedEventArgs

The DownloadStringCompletedEventArgs instance containing the event data.

Raises the CalculateRouteCompleted event to notify subscribers that a route calculation has finished successfully.

C#
protected virtual void OnCalculateRouteCompleted(RoutingCompletedEventArgs e)
Parameters:eRoutingCompletedEventArgs

The event arguments containing the calculated routes.

Raises the CalculateRouteError event to notify subscribers that a route calculation has encountered an error.

C#
protected virtual void OnCalculateRouteError(CalculateRouteErrorEventArgs e)
Parameters:eCalculateRouteErrorEventArgs

The event arguments containing the route calculation error details.

Handles the completion of truck route calculation by processing the JSON response and extracting truck route information.

C#
protected virtual void OnCalculateTruckRouteCompleted(object sender, UploadStringCompletedEventArgs e)
Parameters:senderobject

The sender.

eUploadStringCompletedEventArgs

The UploadStringCompletedEventArgs instance containing the event data.

Raises the CalculateTruckRouteCompleted event to notify subscribers that a truck route calculation has finished successfully.

C#
protected virtual void OnCalculateTruckRouteCompleted(RoutingCompletedEventArgs e)
Parameters:eRoutingCompletedEventArgs

The event arguments containing the calculated truck routes.

Raises the CalculateTruckRouteError event to notify subscribers that a truck route calculation has encountered an error.

C#
protected virtual void OnCalculateTruckRouteError(CalculateRouteErrorEventArgs e)
Parameters:eCalculateRouteErrorEventArgs

The event arguments containing the truck route calculation error details.

Handles the completion of asynchronous file loading from cache and initiates tile download if cache content is unavailable.

C#
protected virtual void OnFileLoadAsyncComplete(string fileName, byte[] content)
Parameters:fileNamestring

Name of the file.

contentbyte[]

The content.

Raises the InitializationComplete event to notify subscribers that provider initialization has finished.

C#
protected virtual void OnInitializationComplete(EventArgs e)
Parameters:eEventArgs

The event arguments.

Raises the InitializationError event to notify subscribers that provider initialization has failed.

C#
protected virtual void OnInitializationError(InitializationErrorEventArgs e)
Parameters:eInitializationErrorEventArgs

The event arguments containing the initialization error details.

Raises the ProviderUpdated event to notify subscribers that provider content has changed.

C#
protected virtual void OnProviderUpdated(EventArgs e)
Parameters:eEventArgs

The event arguments.

Raises the SearchCompleted event to notify subscribers that a search operation has finished successfully.

C#
protected virtual void OnSearchCompleted(SearchCompletedEventArgs e)
Parameters:eSearchCompletedEventArgs

The event arguments containing the search results.

Raises the SearchError event to notify subscribers that a search operation has encountered an error.

C#
protected virtual void OnSearchError(SearchErrorEventArgs e)
Parameters:eSearchErrorEventArgs

The event arguments containing the search error details.

Handles the completion of search requests by processing the JSON response and extracting location information using multiple encoding strategies.

C#
protected virtual void OnSearchRequestCompleted(object sender, DownloadStringCompletedEventArgs e)
Parameters:senderobject

The sender.

eDownloadStringCompletedEventArgs

The DownloadStringCompletedEventArgs instance containing the event data.

Handles tile download completion events, manages cache storage, and updates wraparound tiles with downloaded content.

C#
protected virtual void OnTileDownloadComplete(object sender, TileInfoEventArgs e)
Parameters:senderobject

The sender.

eTileInfoEventArgs

The TileInfoEventArgs instance containing the event data.

Performs an asynchronous search operation using Bing Maps search services with the specified search request parameters.

C#
public void SearchAsync(SearchRequest request)
Parameters:requestSearchRequest

The search request containing query text and search options.

Implements: IMapSearchProvider.SearchAsync(SearchRequest)

Sets the active map view by configuring the imagery set based on the specified view information and label settings.

C#
public virtual void SetView(MapViewInfo view)
Parameters:viewMapViewInfo

The map view information containing the desired imagery set name and label preferences.

Implements: IMapProvider.SetView(MapViewInfo)

Responds to viewport changes by calculating visible tiles, managing tile downloads, and updating the tile matrix for rendering.

C#
public void ViewportChanged(IMapViewport viewport, ViewportChangeAction action)
Parameters:viewportIMapViewport

The current map viewport containing zoom level and visible area information.

actionViewportChangeAction

The type of viewport change that occurred.

Implements: IMapProvider.ViewportChanged(IMapViewport, ViewportChangeAction)

Events

Occurs when an elevation calculation operation has completed successfully with elevation results.

C#
public event EventHandler<ElevationCompletedEventArgs> CalculateElevationCompleted

Implements: IMapElevationProvider.CalculateElevationCompleted

Occurs when an elevation calculation operation encounters an error during execution.

C#
public event EventHandler<CalculateElevationErrorEventArgs> CalculateElevationError

Implements: IMapElevationProvider.CalculateElevationError

Occurs when a route calculation operation has completed successfully with routing results.

C#
public event EventHandler<RoutingCompletedEventArgs> CalculateRouteCompleted

Implements: IMapRouteProvider.CalculateRouteCompleted

Occurs when a route calculation operation encounters an error during execution.

C#
public event EventHandler<CalculateRouteErrorEventArgs> CalculateRouteError

Implements: IMapRouteProvider.CalculateRouteError

Occurs when a truck route calculation operation has completed successfully with truck routing results.

C#
public event EventHandler<RoutingCompletedEventArgs> CalculateTruckRouteCompleted

Implements: IMapTruckRouteProvider.CalculateTruckRouteCompleted

Occurs when a truck route calculation operation encounters an error during execution.

C#
public event EventHandler<CalculateRouteErrorEventArgs> CalculateTruckRouteError

Implements: IMapTruckRouteProvider.CalculateTruckRouteError

Occurs when the Bing Maps provider has completed its initialization process and is ready for use.

C#
public event EventHandler InitializationComplete

Implements: IMapProvider.InitializationComplete

Occurs when provider initialization encounters an error during setup.

C#
public event InitializationErrorEventHandler InitializationError

Implements: IMapProvider.InitializationError

Occurs when the provider content has been updated with new tile data or configuration changes.

C#
public event EventHandler ProviderUpdated

Implements: IMapProvider.ProviderUpdated

Occurs when a search operation has completed successfully with search results.

C#
public event EventHandler<SearchCompletedEventArgs> SearchCompleted

Implements: IMapSearchProvider.SearchCompleted

Occurs when a search operation encounters an error during execution.

C#
public event EventHandler<SearchErrorEventArgs> SearchError

Implements: IMapSearchProvider.SearchError

In this article
DefinitionConstructorsBingRestMapProvider()FieldscacheLoadReferencelockObjtileMatrixPropertiesBingKeyCacheProviderCultureEnableCachingIdImagerySetInitializedInitializingMaxZoomLevelMinZoomLevelSessionIdSettingsTileDownloaderTileSizeUseSessionMethodsBuildElevationRequestUri(ElevationRequest)BuildRoutingRequestUri(RouteRequest)BuildSearchRequestUri(SearchRequest)BuildTruckRouteRequestBody(TruckRouteRequest)BuildTruckRouteRequestUri(TruckRouteRequest)CalculateElevationAsync(ElevationRequest)CalculateRouteAsync(RouteRequest)CalculateTruckRouteAsync(TruckRouteRequest)Clone()GetCacheKey(int, int, int)GetContent(IMapViewport)GetPointsString(List<PointG>)GetSupportedViews()GetTile(int, int, int)GetTileImage(int, int, int)GetTileInfoImage(TileInfo)Initialize()InitializeImageryMetadataCompleted(object, DownloadStringCompletedEventArgs)InitializeImageryService()InitializeSessionCompleted(object, DownloadStringCompletedEventArgs)OnCalculateElevationCompleted(ElevationCompletedEventArgs)OnCalculateElevationCompleted(object, DownloadStringCompletedEventArgs)OnCalculateElevationError(CalculateElevationErrorEventArgs)OnCalculateRouteCompleted(object, DownloadStringCompletedEventArgs)OnCalculateRouteCompleted(RoutingCompletedEventArgs)OnCalculateRouteError(CalculateRouteErrorEventArgs)OnCalculateTruckRouteCompleted(object, UploadStringCompletedEventArgs)OnCalculateTruckRouteCompleted(RoutingCompletedEventArgs)OnCalculateTruckRouteError(CalculateRouteErrorEventArgs)OnFileLoadAsyncComplete(string, byte[])OnInitializationComplete(EventArgs)OnInitializationError(InitializationErrorEventArgs)OnProviderUpdated(EventArgs)OnSearchCompleted(SearchCompletedEventArgs)OnSearchError(SearchErrorEventArgs)OnSearchRequestCompleted(object, DownloadStringCompletedEventArgs)OnTileDownloadComplete(object, TileInfoEventArgs)SearchAsync(SearchRequest)SetView(MapViewInfo)ViewportChanged(IMapViewport, ViewportChangeAction)EventsCalculateElevationCompletedCalculateElevationErrorCalculateRouteCompletedCalculateRouteErrorCalculateTruckRouteCompletedCalculateTruckRouteErrorInitializationCompleteInitializationErrorProviderUpdatedSearchCompletedSearchError
Not finding the help you need?
Contact Support