Version

Using Geographic Polyline Series

Purpose

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

Required background

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

Topic Purpose

This topic provides information on how to add the XamGeographicMap control to an application page.

This topic provides information about layout of map elements in the XamGeographicMap control.

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.

In this topic

This topic contains the following sections:

Geographic Polyline Series

Overview

In the control, the GeographicPolylineSeries is a visual map element that displays geo-spatial data using polylines in a geographic context. This type of geographic series is often used to render roads or connections between geographic locations such as cities or airports. The GeographicPolylineSeries works a lot like the GeographicShapeSeries except that geo-spatial data is rendered with polylines instead of polygons.

Preview

The following is a preview of the control with the GeographicPolylineSeries plotting roads in North America.

GeographicMap Using Geographic Polyline Series 1.png

Data Requirements

Similarly to other types of geographic series in the control, the GeographicPolylineSeries has the ItemsSource property for the purpose of data binding. This property can be bound to an object that implements the IEnumerable interface (e.g. List, Collection, Queue, Stack). In addition, each item in this object must have one data column that stores geographic locations (longitude and latitude) of connected items using the IEnumerable<Point> or IEnumerable<IEnumerable<Point>> structure. The latter is the standard data structure used by shape files and the ShapefileConverter object. This data column is then mapped to the ShapeMemberPath property. The GeographicPolylineSeries uses points of this mapped data column to plot polygons in the control.

Example

The following code shows how to bind the GeographicPolylineSeries to locations of cities loaded from a shape file using the ShapefileConverter.

In XAML:

<ig:ShapefileConverter x:Key="shapefileConverter"
                        ShapefileSource="ShapeFiles/north_america_primary_roads.shp"
                        DatabaseSource="ShapeFiles/north_america_primary_roads.dbf" >
</ig:ShapefileConverter>
<ig:XamGeographicMap x:Name="GeoMap">
    <ig:XamGeographicMap.Series>
        <ig:GeographicPolylineSeries ItemsSource="{StaticResource shapefileConverter}"
                                   ShapeMemberPath="Points">
        </ig:GeographicPolylineSeries>
    </ig:XamGeographicMap.Series>
</ig:XamGeographicMap>

In Visual Basic:

' create and set data binding to the GeographicPolylineSeries
Dim geoSeries = New GeographicPolylineSeries()
geoSeries.ItemsSource = shapefileConverter
geoSeries.ShapeMemberPath = "Points"
' add the GeographicPolylineSeries to the the XamGeographicMap
Me.GeoMap.Series.Add(geoSeries)

In C#:

// create and set data binding to the GeographicPolylineSeries
var geoSeries = new GeographicPolylineSeries();
geoSeries.ItemsSource = shapefileConverter;
geoSeries.ShapeMemberPath = "Points";
// add the GeographicPolylineSeries to the the XamGeographicMap
this.GeoMap.Series.Add(geoSeries);

Related Content

The following topics provide additional information related to this topic.

Topic Purpose

This topic provides information on how to add the control to an application page.

This topic provides information about layout of map elements in the control.

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 control.

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