Skip to main content
A newer version of this page is available. .

MbTilesDataProvider Class

A data provider that loads vector tiles from a MbTiles database.

Namespace: DevExpress.Xpf.Map

Assembly: DevExpress.Xpf.Map.v20.2.dll

NuGet Packages: DevExpress.WindowsDesktop.Wpf.Map, DevExpress.Wpf.Map

Declaration

public class MbTilesDataProvider :
    VectorTileDataProviderBase

Remarks

A set of tiles can be packaged in MbTiles files (wrapped SQLite databases) stored locally or on a server. MbTiles can also contain raster tiles.

Follow the steps below to load data from a MbTiles file:

  1. Install the System.Data.SQLite.Core package if your application does not reference this library.
  2. Create an image layer and add it to the MapControl.Layers collection. Note that the MapControl.Layers is a content property. You can declare layers in XAML directly after a map control’s declaration without wrapping them in opening and closing MapControl.Layers tags.
  3. Create an MbTilesDataProvider instance and assign it to the ImageLayer.DataProvider property. Note that the ImageLayer.DataProvider is a content property. You can declare a provider in XAML directly after a layer’s declaration without wrapping it in opening and closing ImageLayer.DataProvider tags.
  4. Use the MbTilesDataProvider.FileUri property to specify a path to an MbTiles file.
<dxm:MapControl>
    <dxm:ImageLayer>
        <dxm:MbTilesDataProvider FileUri="D:\MapTiles\countries.mbtiles"/>
    </dxm:ImageLayer>
</dxm:MapControl>

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. See Vector Tile Providers: Vector Tile Styles for more information about styles.

<dxm:MbTilesDataProvider ... StyleFileUri="D:\Styles\basic-style.json"/>
See Also