Back to Devexpress

VectorTileDataProviderBase.StyleFileUri Property

windowsforms-devexpress-dot-xtramap-dot-vectortiledataproviderbase.md

latest4.0 KB
Original Source

VectorTileDataProviderBase.StyleFileUri Property

SECURITY-RELATED CONSIDERATIONS

Downloading files passed through URLs specified by the StyleFileUri property may create security issues. Review the following help topic and learn how to spot, analyze, and prohibit unwanted download requests:

Suppress Control Requests to Download Data from External URLs

Gets or sets a style used to customize the vector tile map’s appearance.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
[DefaultValue(null)]
public Uri StyleFileUri { get; set; }
vb
<DefaultValue(Nothing)>
Public Property StyleFileUri As Uri

Property Value

TypeDefaultDescription
Urinull

A Uri object that specifies the style file’s location.

|

Remarks

Use the StyleFileUri property to define a path to a style file. A style should be a valid JSON file and meet specifications.

The Map Control supports layers and the following related properties:

  • filter

  • paint

    • fill-color
    • fill-opacity
    • line-color
    • line-opacity
    • line-width
    • text-color
  • layout

    • visibility
    • text-field
    • text-font
    • text-max-width
    • text-size
    • text-transform

Property values can be set directly (for example, “text-size”: 10) or via an interpolation syntax (for example, “line-width”: {“base”: 1.2, “stops”: [[15, 1], [17, 4]]}).

The following color formats are supported: hsl, rgb, rgba, hsla, hex. You can use web color names, such as red or yellow.

Note: Install the System.Text.Json package if your .NET Framework application does not reference this library. .NET projects do not require manual installation of the System.Text.Json package, as it is already included in the .NET environment. Set the DevExpress.Map.Native.VectorTileStyleParser.ProcessingLibrary property to NewtonsoftJson to use the Newtonsoft.Json library instead.

Example

The following example shows how use the MbTilesDataProvider to load vector tiles from an MbTiles file:

csharp
private void Form1_Load(object sender, EventArgs e) {
    ImageLayer layer = new ImageLayer();
    MbTilesDataProvider dataProvider = new MbTilesDataProvider();
    dataProvider.FileUri = new Uri(@"D:\countries.mbtiles", UriKind.Absolute);
    dataProvider.StyleFileUri = new Uri(@"D:\style.json", UriKind.Absolute);
    layer.DataProvider = dataProvider;
    mapControl1.Layers.Add(layer);
}
vb
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
    Dim layer As ImageLayer = New ImageLayer()
    Dim dataProvider As MbTilesDataProvider = New MbTilesDataProvider()
    dataProvider.FileUri = New Uri("D:\countries.mbtiles", UriKind.Absolute)
    dataProvider.StyleFileUri = New Uri("D:\style.json", UriKind.Absolute)
    layer.DataProvider = dataProvider
    mapControl1.Layers.Add(layer)
End Sub

See Also

VectorTileDataProviderBase Class

VectorTileDataProviderBase Members

DevExpress.XtraMap Namespace