Version

Binding Geographic Data Models

Purpose

This topic provides information on how to bind the XamGeographicMap™ control to models that contain geographic data.

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 information about supported types of geographic series in the XamGeographicMap control.

In this topic

This topic contains the following sections

Binding Geographic Data Models

Introduction

The XamGeographicMap control is designed to display geo-spatial data from shape files and/or geographic locations from data models on geographic imagery maps. The ItemsSource property of geographic series is used for the purpose of binding to data models. This property can be bound to any object that implements the IEnumerable interface (e.g. List, Collection, Queue, Stack). However, some types of geographic series require that each data item must have properties with specific data structures.

The following table summarized data structures required for each type of geographic series :

Geographic Series Data Mapping Properties Description

Specify the names of data columns of ItemsSource items that contain geographic longitude and latitude coordinates of symbols. These properties must be mapped to data columns of numeric type such as double, integer, or float, etc.

Specifies the name of data column of ItemsSource items that contains the geographic points of shapes. This property must be mapped to a data column of IEnumerable<Point> or IEnumerable<IEnumerable<Point>>

Specifies the name of data column of ItemsSource items that contains the geographic coordinates of lines. This property must be mapped to a data column of IEnumerable<Point> or IEnumerable<IEnumerable<Point>>

Preview

The following is a preview of the XamGeographicMap control with GeographicSymbolSeries bound to a data model that contains locations of some cities of the world.

GeographicMap Binding Geographic Data Models 1.png

Example

The following code shows how to bind the GeographicSymbolSeries to a data model that contains geographic locations of some cities of the world stored using the PointList class .

In XAML:

<ig:XamGeographicMap.Series>
    <ig:GeographicSymbolSeries LongitudeMemberPath="X"
                               LatitudeMemberPath="Y">
        <ig:GeographicSymbolSeries.ItemsSource>
            <ig:PointList>
                <Point X="0.12" Y="51.50" x:Uid="London"/>
                <Point X="37.51" Y="55.75" x:Uid="Moscow"/>
                <Point X="151.2" Y="-33.83" x:Uid="Sedney"/>
                <Point X="139.6917" Y="35.6895" x:Uid="Tokyo"/>
                <Point X="77.2250" Y="28.6353" x:Uid="Delhi"/>
                <Point X="-99.1276" Y="19.4270" x:Uid="MexicoCity"/>
                <Point X="-73.9870" Y="40.7561" x:Uid="NewYork"/>
                <Point X="-118.2434" Y="34.0522" x:Uid="LosAngeles"/>
                <Point X="-46.6388" Y="-23.5489" x:Uid="SaoPaulo"/>
            </ig:PointList>
        </ig:GeographicSymbolSeries.ItemsSource>
    </ig:GeographicSymbolSeries>
</ig:XamGeographicMap.Series>

In Visual Basic:

Dim series = New GeographicSymbolSeries()
series.LongitudeMemberPath="X"
series.LatitudeMemberPath="Y"

Dim geoLocations = New Infragistics.Controls.Charts.PointList()

geoLocations.Add(New Point() With { .X = 0.12, .Y = 51.5 })
geoLocations.Add(New Point() With { .X = 37.51, .Y = 55.75 })
geoLocations.Add(New Point() With { .X = 151.2, .Y = -33.83 })
geoLocations.Add(New Point() With { .X = 139.6917, .Y = 35.6895 })
geoLocations.Add(New Point() With { .X = 77.225, .Y = 28.6353 })
geoLocations.Add(New Point() With { .X = -99.1276, .Y = 19.427 })
geoLocations.Add(New Point() With { .X = -73.987, .Y = 40.7561 })
geoLocations.Add(New Point() With { .X = -118.2434, .Y = 34.0522 })
geoLocations.Add(New Point() With { .X = -46.6388, .Y = -23.5489 })

series.ItemsSource = geoLocations
Me.GeoMap.Series.Add(series)

In C#:

var series = new GeographicSymbolSeries();
series.LongitudeMemberPath="X";
series.LatitudeMemberPath="Y";
var geoLocations = new Infragistics.Controls.Charts.PointList();
geoLocations.Add(new Point() { X = 0.12, Y = 51.50 });
geoLocations.Add(new Point() { X = 37.51, Y = 55.75 });
geoLocations.Add(new Point() { X = 151.2, Y = -33.83 });
geoLocations.Add(new Point() { X = 139.6917, Y = 35.6895 });
geoLocations.Add(new Point() { X = 77.2250, Y = 28.6353 });
geoLocations.Add(new Point() { X = -99.1276, Y = 19.4270 });
geoLocations.Add(new Point() { X = -73.9870, Y = 40.7561 });
geoLocations.Add(new Point() { X = -118.2434, Y = 34.0522 });
geoLocations.Add(new Point() { X = -46.6388, Y = -23.5489 });

series.ItemsSource = geoLocations;
this.GeoMap.Series.Add(series);

Related Content

The following topics provide additional information related to 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 information about supported types of geographic series 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.