Version

Merging Bing Maps with Shapefile

Before You Begin

The xamMap™ control’s MapTileSource property is used to configure the source from which geo-imagery is loaded. Please refer to the Supported Geo-Imagery section for a complete list of supported geo-imagery source. However, this section will focus only on BingMaps as the geo-imagery source. Because Bing Maps is a licensed web mapping service from Microsoft®, you will need to get your own credentials for Bing Maps from Microsoft’s website.

It is important to know that the XamMap control’s MapProjectionType property might have to be set in order to match the map projection type used by the image tile provider, otherwise, the Shapefiles being used may not align correctly with the images. In the event that your shape files do not align with the image tiles, you should try to change the xamMap control’s MapProjectionType property to any one of the available enumeration members to see if that resolves the issue. For a complete list of currently supported Map Projection Types, refer to the Understanding xamMap section.

What You Will Accomplish

You will load xamMap with geo-imagery from the BingMaps source and merge it with a Shapefile.

XamMap Merge Bing Maps with Shapefile 01.png

Follow These Steps

The following XAML code assume that you have already set up your WPF project with BingMaps credentials; please refer to the Binding Bing Maps section for more information on this.

  1. Add a MapLayer with a Shapefile to the XamMap control.

In XAML:

        <igMap:XamMap x:Name="xamMap" MapProjectionType="SphericalMercator">
            <!-- NOTE: Bing Maps Tile Source is should be added in code behind -->
            <igMap:XamMap.Layers>
                <!-- Add Shapefile with semi-transparent blue brush -->
                <igMap:MapLayer Name="mapLayer" Brushes="#661E90FF" >
                    <igMap:MapLayer.Reader>
                        <igMap:ShapeFileReader Uri="/../../Shapefiles/europe/eu_countries" />
                    </igMap:MapLayer.Reader>
                </igMap:MapLayer>
            </igMap:XamMap.Layers>
        </igMap:XamMap>
  1. Run the application. The xamMap control will merge the geo-imagery data from BingMaps together with the Shapefile.