Version

Using Geographic Scatter Area Series

Purpose

This topic provides information on how to use the GeographicScatterAreaSeries type of series 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 about layout of map elements in the XamGeographicMap control.

This topic provides information on how triangulation of data points works as well as how it can improve performance of rendering data in the XamGeographicMap control.

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

Geographic Scatter Area Series

Overview

In the XamGeographicMap control, the GeographicScatterAreaSeries is a visual map element that draws a colored surface, in a geographic context, based on a triangulation of longitude and latitude data with a numeric value assigned to each point.

This type of geographic series is useful for rendering scattered data, defined by geographic locations such as weather temperature, precipitation, population distribution, air pollution, etc. The GeographicScatterAreaSeries works a lot like the GeographicContourLineSeries except that it represents data as interpolated and colored surface instead of contour lines connecting data points with the same values.

Preview

The following is a preview of the XamGeographicMap control with GeographicScatterAreaSeries plotting precipitation over the United States. Darker blue regions of the surface indicate higher precipitation and the lighter blue regions indicate lower precipitation.

GeographicMap Using Geographic Scatter Area Series 1.png

Data Requirements

Similar to other types of geographic series in the XamGeographicMap control, the GeographicScatterAreaSeries has the ItemsSource property for the purpose of data binding. This property can be bound to an object that implements an IEnumerable interface.

In addition, each item in the items source must have three data columns, two that store a geographic longitude and latitude coordinates and one data column that stores a value associated with the geographic location. The LongitudeMemberPath, LatitudeMemberPath, and ColorMemberPath properties of the geographic series identify these data column.

The GeographicScatterAreaSeries automatically performs built-in data triangulation on items in the ItemsSource if no triangulation is set to the TrianglesSource property. However, computing triangulation can be a very time-consuming process, so the runtime performance will be better when specifying a TriangulationSource for this property, especially when a large number of data items are present.

Note
Note:

Refer to the Triangulating Geographic Data topic for more information about the process of creating, saving, and loading triangulation data.

Data Binding

The following table summarizes properties of GeographicScatterAreaSeries used for data binding.

Property Name Property Type Description

IEnumerable

Gets or sets the source of items to triangulate if the TrianglesSource property has no triangulation data provided.

IEnumerable

Gets or sets the source of triangulation data. Setting Triangles of the TriangulationSource object to this property improves both runtime performance and geographic series rendering.

string

The name of the property containing the Longitude for each item in the ItemsSource.

string

The name of the property containing the Latitude for each item in the ItemsSource.

string

The name of the property on each data item containing a numeric value, which can be converted to a color by a color scale, set to the ColorScale property.

string

The name of the property of the TrianglesSource items which, for each triangle, contains the index of the first vertex point in the ItemsSource. It is not mandatory to set this property. It is taken by default unless custom triangulation logic is provided.

string

The name of the property of the TrianglesSource items which, for each triangle, contains the index of the first vertex point in the ItemsSource. It is not mandatory to set this property. It is taken by default unless custom triangulation logic is provided.

string

The name of the property of the TrianglesSource items which, for each triangle, contains the index of the first vertex point in the ItemsSource. It is not mandatory to set this property. It is taken by default unless custom triangulation logic is provided.

Color Scale

Use the ColorScale property of the GeographicScatterAreaSeries to resolve colors values of points and thus fill surface of the geographic series. The colors are smoothly interpolated around the shape of the surface by applying a pixel-wise triangle rasterizer to a triangulation data. Because rendering of the surface is pixel-wise, the color scale uses colors instead of brushes.

The provided CustomPaletteColorScale class should satisfy most coloring needs, but the ColorScale base class can be inherited by the application for custom coloring logic.

The following table list properties of the CustomPaletteColorScale affecting surface coloring of the GeographicScatterAreaSeries.

Property Name Property Type Description

ObservableCollection<Color>

Gets or sets the collection of colors to select from or to interpolate between.

Gets or sets the method getting a color from the Palette.

double

The highest value to assign a color. Any given value greater than this value will be Transparent.

double

The lowest value to assign a color. Any given value less than this value will be Transparent.

Example

The following code shows how to bind the GeographicScatterAreaSeries to triangulation data representing precipitation over the United States.

In XAML:

<ig:ItfConverter x:Key="itfConverter" Source="precipitation_observed_20110831.itf" />
<ig:XamGeographicMap.Series>
    <ig:GeographicScatterAreaSeries
          ColorMemberPath="Value"
          LongitudeMemberPath="Point.X"
          LatitudeMemberPath="Point.Y"
          ItemsSource="{Binding TriangulationSource.Points, Source={StaticResource itfConverter}}"
          TrianglesSource="{Binding TriangulationSource.Triangles, Source={StaticResource itfConverter}}"
          TriangleVertexMemberPath1="V1"
          TriangleVertexMemberPath2="V2"
          TriangleVertexMemberPath3="V3">
        <ig:GeographicScatterAreaSeries.ColorScale>
            <ig:CustomPaletteColorScale MinimumValue="0.05" MaximumValue="1.75"
                                        InterpolationMode="InterpolateRGB"
                                        Palette="DarkBlue, Blue, DodgerBlue">
            </ig:CustomPaletteColorScale>
        </ig:GeographicScatterAreaSeries.ColorScale>
    </ig:GeographicScatterAreaSeries>
</ig:XamGeographicMap.Series>

In Visual Basic:

Dim itfConverter = New ItfConverter()
itfConverter.Source = New Uri("precipitation_observed_20110831.itf", UriKind.RelativeOrAbsolute)
Dim colorScale = New CustomPaletteColorScale()
colorScale.MinimumValue = 0.05
colorScale.MinimumValue = 1.75
colorScale.Palette = New ObservableCollection(Of Color)() From { Colors.DarkBlue, Colors.Blue, Colors.DodgerBlue }
Dim geoSeries = New GeographicScatterAreaSeries()
geoSeries.ColorScale = colorScale
geoSeries.LongitudeMemberPath = "Point.X"
geoSeries.LatitudeMemberPath = "Point.Y"
geoSeries.TriangleVertexMemberPath1 = "V1"
geoSeries.TriangleVertexMemberPath2 = "V2"
geoSeries.TriangleVertexMemberPath3 = "V3"
geoSeries.ItemsSource = itfConverter.TriangulationSource.Points
geoSeries.TrianglesSource = itfConverter.TriangulationSource.Triangles

In C#:

var itfConverter = new ItfConverter();
itfConverter.Source = new Uri("precipitation_observed_20110831.itf", UriKind.RelativeOrAbsolute);
var colorScale = new CustomPaletteColorScale();
colorScale.MinimumValue = 0.05;
colorScale.MinimumValue = 1.75;
colorScale.Palette = new ObservableCollection<Color>
{
     Colors.DarkBlue,
     Colors.Blue,
     Colors.DodgerBlue
};
var geoSeries = new GeographicScatterAreaSeries();
geoSeries.ColorScale = colorScale;
geoSeries.LongitudeMemberPath = "Point.X";
geoSeries.LatitudeMemberPath = "Point.Y";
geoSeries.TriangleVertexMemberPath1 = "V1";
geoSeries.TriangleVertexMemberPath2 = "V2";
geoSeries.TriangleVertexMemberPath3 = "V3";
geoSeries.ItemsSource = itfConverter.TriangulationSource.Points;
geoSeries.TrianglesSource = itfConverter.TriangulationSource.Triangles;

Related Content

The following topics provide additional information related to this topic.

Topic Purpose

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

This topic provides information on how triangulation of data points works as well as how it can improve performance of rendering data in the XamGeographicMap control.

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 GeographicContourLineSeries type of series in the XamGeographicMap control.