Skip to main content
All docs

UriBasedVectorTileDataProvider Class

Provides map data from a set of PBF or MVT files.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v23.1.dll

NuGet Package: DevExpress.Win.Map


public class UriBasedVectorTileDataProvider :


You can use UriBasedVectorTileDataProvider to draw a map based on a set of .PBF or .MVT files that store vector tiles in binary format.

  1. Create an image layer and add it to the MapControl.Layers collection.
  2. Create a UriBasedVectorTileDataProvider instance and assign it to the ImageLayer.DataProvider property.
  3. Specify the UriBasedVectorTileDataProvider.TileUriTemplate property.
ImageLayer layer = new ImageLayer();
UriBasedVectorTileDataProvider dataProvider = new UriBasedVectorTileDataProvider();            
dataProvider.TileUriTemplate = @"D:\PbfFiles\{x}-{y}-{level}.pbf";
layer.DataProvider = dataProvider;

Apply a Custom Style

If a default vector tile style does not meet your requirements, you can apply a custom style. Use the VectorTileDataProviderBase.StyleFileUri property to define a path to a style file. The MapControl uses the Newtonsoft.Json library to parse style files. Install the Newtonsoft.Json package if your application does not reference this library. See Vector Tile Providers: Vector Tile Styles for more information about styles.

The following code loads a style file from the project’s Data directory:

dataProvider.StyleFileUri = new Uri(GetRelativePath("style.json"), UriKind.Absolute);

public static string GetRelativePath(string name) {
    name = "Data\\" + name;
    DirectoryInfo dir = new DirectoryInfo(Application.StartupPath);
    while (dir != null) {
        string filePath = Path.Combine(dir.FullName, name);
        if (File.Exists(filePath))
            return filePath;
        dir = Directory.GetParent(dir.FullName);
    return string.Empty;
See Also