Version

Using Markers in Geographic Series

Purpose

This topic provides information on how to use markers in geographic series of the XamGeographicMap™ control.

Required background

The following table lists the topics required as a prerequisite to understanding this topic.

Topic Purpose

This topic provides resources with information about maps, shape files, and geo-spatial related material. Use these resources to learn about and obtain geo-spatial shape files as well as tools for their editing.

This topic provides information on how to bind shape files with geo-spatial data to the XamGeographicMap control.

This topic provides information on how to use the GeographicSymbolSeries element in the XamGeographicMap control.

This topic provides information on how to use the GeographicShapeSeries element in the XamGeographicMap control.

Displaying Basic Markers in Geographic Series

Overview

In the XamGeographicMap control, markers are visual elements that display values of data items bound to geographic series in geographic locations of the map. Marker can be represented as labels, symbols or custom data templates.

The following types of geographic series support markers:

Property settings

The following table maps the desired configuration to property settings of geographic series.

In order to: Use this property: And set it to:

Display markers

Circle

Change markers’ brush

Change markers’ outline

Enable markers’ collision avoidance

Fade

Example

The screenshot below demonstrates how the XamGeographicMap control looks as a result of the following settings:

Property Value

Circle

Blue

Black

None

GeographicMap Using Markers in Geographic Series 1.png

Code

The following code changes the appearance of markers in the GeographicSymbolSeries

In XAML:

<ig:XamGeographicMap.Series>
    <ig:GeographicSymbolSeries ItemsSource="{StaticResource shapefileConverter}"
                                MarkerBrush="Blue"
                                MarkerOutline="Black"
                                MarkerCollisionAvoidance="None"
                                LongitudeMemberPath="Points[0][0].X"
                                LatitudeMemberPath="Points[0][0].Y">
    </ig:GeographicSymbolSeries>
</ig:XamGeographicMap.Series>

In C#:

var geoSeries = new GeographicSymbolSeries();
geoSeries.ItemsSource = shapefileConverter;
geoSeries.MarkerBrush = new SolidBrush(Color.Blue);
geoSeries.MarkerOutline = new SolidBrush(Color.Black);
geoSeries.MarkerCollisionAvoidance = CollisionAvoidanceType.None;
geoSeries.LatitudeMemberPath = "Points[0][0].X";
geoSeries.LongitudeMemberPath = "Points[0][0].Y";
this.geoMap.Series.Add(geoSeries);

In VB:

Dim geoSeries = new GeographicSymbolSeries()
geoSeries.ItemsSource = shapefileConverter
geoSeries.MarkerBrush = new SolidBrush(Color.Blue)
geoSeries.MarkerOutline = new SolidBrush(Color.Black)
geoSeries.MarkerCollisionAvoidance = CollisionAvoidanceType.None
geoSeries.LatitudeMemberPath = "Points[0][0].X"
geoSeries.LongitudeMemberPath = "Points[0][0].Y"
Me.geoMap.Series.Add(geoSeries)

Creating Custom Markers in Geographic Series

Overview

The MarkerTemplate property of geographic series can be used to provide custom data templates to display custom symbols and/or values of data items. Custom data templates can access values of data items bound to the ItemsSource property of geographic series by binding to the Item property. When a geographic series is bound to the ShapefileConverter then the Item property is resolved to a ShapefileRecord object and values loaded from a shape database (.dbf) file can be accessed through the Fields property.

Preview

The following is a preview of the XamGeographicMap control with markers displaying names of countries on all shapes of GeographicShapeSeries.

GeographicMap Using Markers in Geographic Series 2.png

Example

The following code creates a custom data template for markers of GeographicShapeSeries with binding to a data column that contains names of countries.

In XAML:

<ig:GeographicShapeSeries ItemsSource="{StaticResource shapefileConverter}"
                          ShapeMemberPath="Points"
                          MarkerCollisionAvoidance="Fade">
    <ig:GeographicShapeSeries.MarkerTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Path=Item.Fields[CNTRY_NAME]}" FontWeight="Bold" />
        </DataTemplate>
    </ig:GeographicShapeSeries.MarkerTemplate>
</ig:GeographicShapeSeries>

Related Content

The following topics provide additional information related to this topic.

Topic Purpose

This topic provides resources with information about maps, shape files, and geo-spatial related material. Use these resources to learn about and obtain geo-spatial shape files as well as tools for their editing.

This topic provides information on how to bind shape files with geo-spatial data to the XamGeographicMap control.

This topic provides information about supported types of geographic series in the XamGeographicMap control.