OpenStreetMapDataProvider.TileUriTemplate Property

Gets or sets a template that is used to obtain image tiles from the current OpenStreetMap provider.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v20.1.dll


public string TileUriTemplate { get; set; }
Public Property TileUriTemplate As String

Property Value

Type Description

A String that contains the template Uri.



Use of this property assumes that an OSM Tile Server is used. This means that all tiles for all zoom levels can be loaded. In a case when not all tiles are available, design a custom tile provider.

Use the following pattern to specify TemplateUriTemplate: https://{0}{1}/{2}/{3}.png

Template placeholders will be replaced with the following values on a tile request.

  • {0} - A sub-domain of the OSM server.
  • {1} - The current zoom level.
  • {2} - The horizontal (X) index of the requested tile.
  • {3} - The vertical (Y) index of the requested tile.

Before using map images in the OpenStreetMap format, please review the Copyright and License and Tile usage policy pages.

To control which web resource should be used in your application as an OpenStreetMap data provider, you should assign specific values for the OpenStreetMapDataProvider.TileUriTemplate property. Note that by default, this property is set to obtain data from the OpenStreetMap official web service.

Note that if the TileUriTemplate property contains an invalid URI, the layer to which the provider is assigned raises the LayerBase.Error event.


This example demonstrates how to connect to the OpenStreetMap using the OpenStreetMapDataProvider object.

using System;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraMap;

namespace ConnectToOpenStreet {
    public partial class Form1 : Form {
        public Form1() {

        private void Form1_Load(object sender, EventArgs e) {
            // Create a map control.
            MapControl map = new MapControl();

            // Specify the map position on the form.           
            map.Dock = DockStyle.Fill;

            // Add the map control to the window.

            // Create an image tiles layer and add it to the map.
            ImageLayer tileLayer = new ImageLayer();

            // Create an Open Street data provider.
            OpenStreetMapDataProvider provider = new OpenStreetMapDataProvider();
            tileLayer.DataProvider = provider;

            // Specify a template that is used to obtain image tiles. 
            provider.TileUriTemplate = "http://{subdomain}{tileLevel}/{tileX}/{tileY}.png";

            provider.WebRequest += OnWebRequest;

        private void OnWebRequest(object sender, MapWebRequestEventArgs e) {
            e.UserAgent = "XtraMap Getting Started - Connect to OpenStreetMap";
See Also