This topic provides information on how to use the GeographicShapeSeries element in the XamGeographicMap™ control.
The following table lists the topics required as a prerequisite to understanding this topic.
This topic contains the following sections:
In the XamGeographicMap control, the GeographicShapeSeries is a visual map element that displays geo-spatial data using shape polygons in a geographic context. This type of geographic series is often used to render shapes of countries or regions defined by geographic locations. The GeographicShapeSeries works a lot like the GeographicPolylineSeries except that geo-spatial data is rendered with polygons instead of polylines.
The following is a preview of the XamGeographicMap control with GeographicShapeSeries plotting countries of the world.
Similarly to other types of geographic series in the XamGeographicMap control, the GeographicShapeSeries has the ItemsSource property for the purpose of data binding. This property can be bound to an object that implements IEnumerable interface. In addition, each item in this object must have one data column that stores geographic locations (longitude and latitude) of a shape using the IEnumerable<Point> or IEnumerable<IEnumerable<Point>> structure. The latter is the standard data structure used by shape files and the ShapefileConverter class. This data column is then mapped to the ShapeMemberPath property. The GeographicShapeSeries uses points of this mapped data column to plot polygons in the XamGeographicMap control.
The following code shows how to bind the GeographicShapeSeries to shapes of countries in the world loaded from a shape file using the ShapefileConverter.
In XAML:
<ig:ShapefileConverter x:Key="shapefileConverter"
ShapefileSource="ShapeFiles/world_countries.shp"
DatabaseSource="ShapeFiles/world_countries.dbf" >
</ig:ShapefileConverter>
<ig:XamGeographicMap x:Name="GeoMap">
<ig:XamGeographicMap.Series>
<ig:GeographicShapeSeries ItemsSource="{StaticResource shapefileConverter}"
ShapeMemberPath="Points">
</ig:GeographicShapeSeries>
</ig:XamGeographicMap.Series>
</ig:XamGeographicMap>
In Visual Basic:
' create and set data binding to the GeographicShapeSeries
Dim geoSeries = New GeographicShapeSeries()
geoSeries.ItemsSource = shapefileConverter
geoSeries.ShapeMemberPath = "Points"
' add the GeographicShapeSeries to the the XamGeographicMap
Me.GeoMap.Series.Add(geoSeries)
In C#:
// create and set data binding to the GeographicShapeSeries
var geoSeries = new GeographicShapeSeries();
geoSeries.ItemsSource = shapefileConverter;
geoSeries.ShapeMemberPath = "Points";
// add the GeographicShapeSeries to the the XamGeographicMap
this.GeoMap.Series.Add(geoSeries);
The following topics provide additional information related to this topic.