This topic provides information on how to use the GeographicScatterAreaSeries type of series 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 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.
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.
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.
The following table summarizes properties of GeographicScatterAreaSeries used for data binding.
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.
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;
The following topics provide additional information related to this topic.