skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • AI Coding Assistants
    • Embedded Reporting
    • Document Processing Libraries
    • SSO Account Sign-in

    Web

    Kendo UI UI for Angular UI for Vue UI for jQuery KendoReact UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Telerik JustMock

    CMS

    Sitefinity

    AI Productivity Tools

    AI Coding Assistants

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    KendoReact Free VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Support and Learning

    • Support and Learning Hub
    • First Steps
    • Docs
    • Demos
    • Virtual Classroom
    • Forums
    • Videos
    • Blogs
    • Accessibility
    • Submit a Ticket

    Productivity and Design Tools

    • Visual Studio Extensions
    • Visual Studio Templates
    • Embedded Reporting
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class OpenStreetMapProvider

Provides map tile services using OpenStreetMap as the data source, implementing both IMapProvider and IMapTileProvider interfaces for map rendering and tile management.

Inheritance
System.Object
OpenStreetMapProvider
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.RadMap.dll

Syntax

public class OpenStreetMapProvider : IMapProvider, ICloneable, IMapTileProvider

Constructors

OpenStreetMapProvider()

Initializes a new instance of the OpenStreetMapProvider class with default tile downloader and memory cache provider.

Declaration
public OpenStreetMapProvider()

Fields

cacheLoadReference

Declaration
protected Dictionary<string, List<TileInfo>> cacheLoadReference
Field Value
System.Collections.Generic.Dictionary<System.String, System.Collections.Generic.List<TileInfo>>

lockObj

Declaration
protected object lockObj
Field Value
System.Object

Properties

CacheProvider

Gets or sets the cache provider used for storing and retrieving downloaded map tiles to improve performance and reduce network requests.

Declaration
public IMapCacheProvider CacheProvider { get; set; }
Property Value
IMapCacheProvider

Implements
IMapTileProvider.CacheProvider

EnableCaching

Gets or sets a value indicating whether tile caching is enabled for this provider to store downloaded tiles locally.

Declaration
public bool EnableCaching { get; set; }
Property Value
System.Boolean

Implements
IMapTileProvider.EnableCaching

Id

Gets the unique identifier for this map provider instance.

Declaration
public string Id { get; }
Property Value
System.String

Implements
IMapProvider.Id

ImageUrl

Gets or sets the URL template used for downloading OpenStreetMap tiles, supporting placeholder tokens for coordinates and zoom level.

Declaration
public string ImageUrl { get; set; }
Property Value
System.String

Initialized

Gets or sets a value indicating whether this OpenStreetMapProvider has completed its initialization process.

Declaration
public bool Initialized { get; protected set; }
Property Value
System.Boolean

MaxZoomLevel

Gets or sets the maximum zoom level supported by this OpenStreetMap provider.

Declaration
public int MaxZoomLevel { get; set; }
Property Value
System.Int32

Implements
IMapProvider.MaxZoomLevel

MinZoomLevel

Gets or sets the minimum zoom level supported by this OpenStreetMap provider.

Declaration
public int MinZoomLevel { get; set; }
Property Value
System.Int32

Implements
IMapProvider.MinZoomLevel

TileDownloader

Gets or sets the tile downloader responsible for asynchronously downloading map tiles from OpenStreetMap servers.

Declaration
public IMapTileDownloader TileDownloader { get; set; }
Property Value
IMapTileDownloader

Implements
IMapTileProvider.TileDownloader

TileSize

Gets the size of map tiles used by this provider, typically 256x256 pixels for OpenStreetMap.

Declaration
public Size TileSize { get; }
Property Value
System.Drawing.Size

Implements
IMapTileProvider.TileSize

Methods

Clone()

Creates a deep copy of this OpenStreetMapProvider instance with identical configuration settings.

Declaration
public virtual object Clone()
Returns
System.Object

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

Implements
System.ICloneable.Clone()

GetCacheKey(Int32, Int32, Int32)

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

Declaration
protected virtual string GetCacheKey(int tileX, int tileY, int zoomLevel)
Parameters
System.Int32 tileX

The X coordinate of the tile.

System.Int32 tileY

The Y coordinate of the tile.

System.Int32 zoomLevel

The zoom level of the tile.

Returns
System.String

A string representing the unique cache key for the specified tile.

GetContent(IMapViewport)

Retrieves the visual elements representing map tiles for the current viewport, converting cached tile data to renderable map elements.

Declaration
public IEnumerable<MapVisualElement> GetContent(IMapViewport viewport)
Parameters
IMapViewport viewport

The IMapViewport defining the current view area and settings.

Returns
System.Collections.Generic.IEnumerable<MapVisualElement>

An enumerable collection of MapVisualElement objects representing the visible map tiles.

Implements
IMapProvider.GetContent(IMapViewport)

GetSupportedViews()

Gets the list of supported map views for this provider, returning null as OpenStreetMap uses a standard view.

Declaration
public List<MapViewInfo> GetSupportedViews()
Returns
System.Collections.Generic.List<MapViewInfo>

A list of MapViewInfo objects, or null if standard views are used.

Implements
IMapProvider.GetSupportedViews()

GetTile(Int32, Int32, Int32)

Constructs the complete URL for retrieving a specific map tile from OpenStreetMap servers based on tile coordinates and zoom level.

Declaration
public Uri GetTile(int tileMatrixX, int tileMatrixY, int zoomLevel)
Parameters
System.Int32 tileMatrixX

The X coordinate of the tile in the tile matrix.

System.Int32 tileMatrixY

The Y coordinate of the tile in the tile matrix.

System.Int32 zoomLevel

The zoom level for the requested tile.

Returns
System.Uri

A System.Uri object representing the complete URL for the tile request.

GetTileImage(Int32, Int32, Int32)

Synchronously retrieves a map tile image for the specified coordinates and zoom level, utilizing cache when available.

Declaration
public Image GetTileImage(int tileMatrixX, int tileMatrixY, int zoomLevel)
Parameters
System.Int32 tileMatrixX

The X coordinate of the tile in the tile matrix.

System.Int32 tileMatrixY

The Y coordinate of the tile in the tile matrix.

System.Int32 zoomLevel

The zoom level for the requested tile.

Returns
System.Drawing.Image

An System.Drawing.Image object containing the tile image data.

Implements
IMapTileProvider.GetTileImage(Int32, Int32, Int32)

GetTileInfoImage(TileInfo)

Initiates the asynchronous loading of tile image data, either from cache or by downloading from OpenStreetMap servers.

Declaration
protected virtual void GetTileInfoImage(TileInfo tileInfo)
Parameters
TileInfo tileInfo

The TileInfo object containing tile coordinates and metadata for the image request.

Initialize()

Initializes the provider, marking it as ready for tile requests and raising the initialization complete event.

Declaration
public void Initialize()
Implements
IMapProvider.Initialize()

OnFileLoadAsyncComplete(String, Byte[])

Handles the completion of asynchronous file loading operations from the cache provider, updating tile content or initiating download if cache miss occurs.

Declaration
protected virtual void OnFileLoadAsyncComplete(string fileName, byte[] content)
Parameters
System.String fileName

The cache key identifier for the loaded file.

System.Byte[] content

The byte array containing the loaded tile image data, or null if not found in cache.

OnInitializationComplete(EventArgs)

Raises the InitializationComplete event when provider initialization is successfully completed.

Declaration
protected virtual void OnInitializationComplete(EventArgs e)
Parameters
System.EventArgs e

An System.EventArgs that contains the event data.

OnInitializationError(InitializationErrorEventArgs)

Raises the InitializationError event when an error occurs during provider initialization.

Declaration
protected virtual void OnInitializationError(InitializationErrorEventArgs e)
Parameters
InitializationErrorEventArgs e

An InitializationErrorEventArgs that contains the error information.

OnProviderUpdated(EventArgs)

Raises the ProviderUpdated event when provider content changes, such as when new tiles are available.

Declaration
protected virtual void OnProviderUpdated(EventArgs e)
Parameters
System.EventArgs e

An System.EventArgs that contains the event data.

OnTileDownloadComplete(Object, TileInfoEventArgs)

Handles the completion of tile download operations, updating cache storage and synchronizing tile content across wraparound instances.

Declaration
protected virtual void OnTileDownloadComplete(object sender, TileInfoEventArgs e)
Parameters
System.Object sender

The source of the event.

TileInfoEventArgs e

The TileInfoEventArgs containing the downloaded tile information and image data.

SetView(MapViewInfo)

Sets the active map view for this provider, currently not implemented for OpenStreetMap.

Declaration
public void SetView(MapViewInfo view)
Parameters
MapViewInfo view

The MapViewInfo representing the desired map view.

Implements
IMapProvider.SetView(MapViewInfo)

ViewportChanged(IMapViewport, ViewportChangeAction)

Responds to viewport changes by calculating and managing the visible tiles required for the current view, handling tile loading and caching operations.

Declaration
public void ViewportChanged(IMapViewport viewport, ViewportChangeAction action)
Parameters
IMapViewport viewport

The IMapViewport representing the current view settings and visible area.

ViewportChangeAction action

The ViewportChangeAction indicating the type of viewport change that occurred.

Implements
IMapProvider.ViewportChanged(IMapViewport, ViewportChangeAction)

Events

InitializationComplete

Occurs when the provider initialization process is completed successfully.

Declaration
public event EventHandler InitializationComplete
Event Type
System.EventHandler

Implements
IMapProvider.InitializationComplete

InitializationError

Occurs when an error is encountered during the provider initialization process.

Declaration
public event InitializationErrorEventHandler InitializationError
Event Type
InitializationErrorEventHandler

Implements
IMapProvider.InitializationError

ProviderUpdated

Occurs when the provider content is updated, typically after new tiles are loaded or downloaded.

Declaration
public event EventHandler ProviderUpdated
Event Type
System.EventHandler

Implements
IMapProvider.ProviderUpdated

Extension Methods

SvgExtentions.Traverse<T>(T, Func<T, IEnumerable<T>>)
SvgExtentions.TraverseDepthFirst<T>(T, Func<T, IEnumerable<T>>)
Getting Started
  • Install Now
  • Demos
  • Step-by-Step Tutorial
  • Sample Applications
  • SDK Samples
  • Visual Studio Extensions
Support Resources
  • Code Library
  • Knowledge Base
  • Videos
Community
  • Forums
  • Blogs
  • Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.