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

VectorLayerBase.InitialMapSize Property

OBSOLETE

The VectorLayerBase.InitialMapSize is obsolete use the InitialMapSize instead.

Gets or sets the size of a map shape tile to provide a map projection.

Namespace: DevExpress.Xpf.Map

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

Declaration

[Obsolete("The VectorLayerBase.InitialMapSize is obsolete use the MapControl.InitialMapSize instead.", true)]
[PreferableMember("MapControl", "InitialMapSize", "Size")]
[Browsable(false)]
public Size InitialMapSize { get; set; }

Property Value

Type Description
Size

A Size value containing the size of the map tiles that correspond to the zero zoom level.

Remarks

Use the InitialMapSize property to get a map projection (e.g., Lambert, Behrmann, Tristan Edwards equal map projections) and avoid distortions of a vector layer’s elements on a plane.

Example

This example illustrates how to get equal-area map projections (Lambert, Behrmann, Tristan Edwards, Peters, Gall orthographic and Balthasart) for the shapes loaded from the Shapefiles (Countries.shp, Countries.dbf).

To accomplish this task, create an EqualAreaProjection object and assign it to the VectorLayerBase.MapProjection property. Then, specify the Width/height aspect ratio for each equal area projection using the VectorLayerBase.InitialMapSize property.

To learn more about the equal-area projections, see Cylindrical_equal-area_projection.

using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;

namespace AvoidMapDistortion {
    public partial class MainWindow : Window {
        public struct WidthHeightRatio {
            public string Name { get; set; }
            public double Value { get; set; }
        }

        int defaultSideSize = 512;
        List<WidthHeightRatio> ratios = new List<WidthHeightRatio>() {
            new WidthHeightRatio() { Name = "(Default)", Value = 1 },
            new WidthHeightRatio() { Name = "Lambert", Value = 3.14 },
            new WidthHeightRatio() { Name = "Behrmann", Value = 2.36 },
            new WidthHeightRatio() { Name = "Trystan Edwards", Value = 2.0 },
            new WidthHeightRatio() { Name = "Gall-Peters", Value = 1.57 },
            new WidthHeightRatio() { Name = "Balthasart", Value = 1.3 }
        };
        public List<WidthHeightRatio> Ratios { get { return ratios; } }

        public MainWindow() {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e) {
            this.DataContext = Ratios;
        }

        private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) {
            mapControl.InitialMapSize = new Size() {
                Width = defaultSideSize,
                Height = (int)(defaultSideSize / ((WidthHeightRatio)lbRatio.SelectedValue).Value)
            };
        }
    }
}
See Also