New to Telerik UI for WinFormsStart a free 30-day trial

Layers Overview

Updated over 6 months ago

Layers provide an easy way to present meaningful information to the end user. A RadMap control may have many layers each responsible for a different part of the presentation logic. The layer object represents a collection holding MapVisualElements. The RadMap.Layers property is responsible for exposing the layers allowing easy access and manipulation.

Figure 1: Map Layers

WinForms RadMap Map Layers

The example below uses the BingRestMapProvider and adds pin and label elements to a couple of layers defined within the RadMap control.

Setup Layers

C#
private void SetupLayers()
{
    MapLayer easternLayer = new MapLayer("Eastern");
    this.radMap1.Layers.Add(easternLayer);
    MapLayer westernLayer = new MapLayer("Western");
    this.radMap1.Layers.Add(westernLayer);
}

Setup Data

C#
private void SetupData()
{
    MapPin element = new MapPin(new PointG(34.0140562, -118.2880489));
    element.Text = "Los Angeles";
    element.BackColor = Color.Red;
    this.radMap1.Layers["Western"].Add(element);
    element = new MapPin(new PointG(47.5951518, -122.3316280));
    element.Text = "Seattle";
    element.BackColor = Color.Red;
    this.radMap1.Layers["Western"].Add(element);
    element = new MapPin(new PointG(29.4270198, -98.43744520));
    element.Text = "San Antonio";
    element.BackColor = Color.Red;
    this.radMap1.Layers["Western"].Add(element);
    element = new MapPin(new PointG(41.8806908, -87.67416460));
    element.Text = "Chicago";
    element.BackColor = Color.Blue;
    this.radMap1.Layers["Eastern"].Add(element);
    element = new MapPin(new PointG(40.8296426, -73.92636320));
    element.Text = "New York";
    element.BackColor = Color.Blue;
    this.radMap1.Layers["Eastern"].Add(element);
    element = new MapPin(new PointG(42.3665137, -71.06160420));
    element.Text = "Boston";
    element.BackColor = Color.Blue;
    this.radMap1.Layers["Eastern"].Add(element);
    MapLabel westernLabel = new MapLabel(new PointG(36.251282d, -111.593335d), "Western")
    {
        BackColor = Color.FromArgb(122, 255, 0, 0)
    };
    MapLabel easternLabel = new MapLabel(new PointG(38.790412d, -81.000594d), "Eastern")
    {
        BackColor = Color.FromArgb(122, 0, 0, 255)
    };
    this.radMap1.Layers["Western"].Add(westernLabel);
    this.radMap1.Layers["Eastern"].Add(easternLabel);
}

See Also

In this article
See Also
Not finding the help you need?
Contact Support