Skip to main content
All docs
V26.1
  • VectorTileDataProviderBase.GetStream(Int64, Int64, Int64) Method

    Returns a stream that contains a vector tile with specific coordinates at a specified zoom level.

    Namespace: DevExpress.XtraMap

    Assembly: DevExpress.XtraMap.v26.1.dll

    NuGet Package: DevExpress.Win.Map

    Declaration

    public virtual Stream GetStream(
        long x,
        long y,
        long level
    )

    Parameters

    Name Type Description
    x Int64

    An x-coordinate of a tile in the grid.

    y Int64

    A y-coordinate of a tile in the grid.

    level Int64

    A zoom level.

    Returns

    Type Description
    Stream

    A stream that contains a tile.

    Remarks

    Follow the steps below to implement a provider that loads tiles from a custom source.

    • Create a provider class that implements VectorTileDataProviderBase.
    • Implement the VectorTileDataProviderBase.GetStream method so that it returns a tile as a sequence of bytes for specific coordinates in the tile grid at the specified zoom level.
    • Assign the provider to the ImageLayer.DataProvider property.

      View Example

      using DevExpress.XtraMap;
      using System.IO;
      using System.Windows.Forms;
      
      namespace WinFormsMap {
          public partial class Form1 : Form {
              public Form1() {
                  InitializeComponent();
                  var layer = new ImageLayer();
                  var provider = new CustomVectorTileStreamProvider();
      
                  layer.DataProvider = provider;
                  mapControl1.Layers.Add(layer);
              }
          }
          public class CustomVectorTileStreamProvider : VectorTileDataProviderBase {
              public override Stream GetStream(long x, long y, long level) {
                  string path = Path.GetFullPath("..\\..\\Data\\test.data");
                  return File.OpenRead(path);
              }
          }
      }
      
    See Also