Skip to main content

How to: Specify a Map Projection

This example demonstrates how to specify the map projection that is used to display geographical data for a Map Control.

To configure a map projection, specify the GeoMapCoordinateSystem.Projection property of the GeoMapCoordinateSystem object. Assign it to the MapControl.CoordinateSystem property.

One of the following predefined map projections can be used.

<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxm="http://schemas.devexpress.com/winfx/2008/xaml/map"
        x:Class="MapProjections.MainWindow"
        Title="MainWindow">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <dxm:MapControl Grid.Column="0" Margin="4,4,2,4">
            <dxm:MapControl.CoordinateSystem>
                <dxm:GeoMapCoordinateSystem 
                    Projection="{Binding ElementName=lbProjection, Path=SelectedItem}"/>
            </dxm:MapControl.CoordinateSystem>
            <dxm:VectorLayer>
                <dxm:ShapefileDataAdapter FileUri="Data/Countries.shp"/>
            </dxm:VectorLayer>
        </dxm:MapControl>
        <StackPanel Grid.Column="1" Margin="2,4,4,4" Orientation="Vertical">
            <Label Content="Map Projection:"/>
            <ListBox Name="lbProjection">
                <dxm:BraunStereographicProjection/>
                <dxm:EllipticalMercatorProjection/>
                <dxm:EqualAreaProjection/>
                <dxm:EquidistantProjection/>
                <dxm:EquirectangularProjection/>
                <dxm:KavrayskiyProjection/>
                <dxm:LambertCylindricalEqualAreaProjection/>
                <dxm:MillerProjection/>
                <dxm:SinusoidalProjection/>
                <dxm:SphericalMercatorProjection/>
                <dxm:Etrs89LambertAzimuthalEqualAreaProjection/>
            </ListBox>
        </StackPanel>
    </Grid>
</Window>