Parallels and meridians represent the system of geographic grid lines (graticule) and their corresponding latitude and longitude labels. These grid lines are automatically updated whenever the map projection is changed or the Viewport extent is adjusted through panning or zooming.
As you navigate a map, parallels and meridians can help you to pinpoint locations on a map in terms of standard geographic coordinates.
|Figure 1: Parallels and meridians displayed using the Hammer-Aitoff map projection.|
Properties at Design-Time
Parallels and meridians can be configured at design-time using the Visual Studio property editor as shown in Figure 2 below. A variety of properties for controlling appearance and behavior are provided.
The MapControl.Parallels and MapControl.Meridians members have the same set of properties and both are of type Dundas.Maps.WebControl.GridAttributes. Each set of properties can be adjusted independently of the other.
|Figure 2: Properties for parallels and meridians in Visual Studio.|
Appearance and Behavior
Since parallels and meridians have the same set of properties, this section will focus on examples for parallels.
Displaying Under Map Content
By default, grid lines are drawn on top of map content elements such as shapes. To have the grid lines (together with their latitude and longitude labels) drawn underneath any map content, set the MapControl.GridUnderContent property to True. This is useful if you wish to place extra emphasis on shapes and not have any grid lines (or their labels) overlapping them. Note that if the shapes on a map are not colored or are partially transparent, the grid lines underneath will still show through.
By default, parallels and meridians are visible in the Viewport. To hide the parallels only, set the Parallels.Visible property to False. This will also hide the latitude labels associated with the parallels. To hide just the latitude labels for the parallels, set the Parallels.ShowLabels property to False.
The color of the parallel grid lines can be changed using the Parallels.LineColor property. It is often useful to choose a partially transparent color so that the grid lines do not stand out too much in relation to map content elements such as shapes.
The color of the latitude labels can be changed using the Parallels.LabelColor property. As with the grid lines, it is often useful to choose a partially transparent color to keep the focus on the map content.
The font for the labels can be changed using the Parallels.Font property.
By default, a latitude label appears at the left end of a parallel. To display the latitude labels at other positions along the grid lines, use the Parallels.LabelPosition property. Technically speaking though, the label position is interpreted as being relative to the Viewport, not the associated grid line. This means that if you pan the map such that the grid lines begin to go out of view, the map control will still try to display the labels within the Viewport (at least until the entire map has been panned out of view).
By default, the spacing in degrees between two parallel grid lines is chosen automatically. To set a specific interval in degrees, use the Parallels.Interval property.
This example demonstrates how to set the properties for the grid lines programmatically. The resultant map is shown in Figure 3 below.
|Figure 3: Parallels and meridians using partially transparent colors, dashed lines, and centered label positions.|
|Visual Basic||Copy Code|
Imports Dundas.Maps.WebControl ... ' Display parallels and meridians on top of map content. MapControl1.GridUnderContent = False ' Make sure parallels and latitude labels are visible. MapControl1.Parallels.Visible = True MapControl1.Parallels.ShowLabels = True ' Set the line color to be partially transparent and apply a dashed line style. MapControl1.Parallels.LineColor = Color.FromArgb(128, Color.Magenta) MapControl1.Parallels.LineStyle = MapDashStyle.Dash MapControl1.Parallels.LineWidth = 1 ' Set the label color, font, and label position. MapControl1.Parallels.LabelColor = Color.FromArgb(128, Color.Green) MapControl1.Parallels.Font = New Font("MS Sans Serif", 8, FontStyle.Regular) MapControl1.Parallels.LabelPosition = LabelPosition.Center ' Choose a 5 degree interval for the grid. MapControl1.Parallels.Interval = 5
using Dundas.Maps.WebControl; ... // Display parallels and meridians on top of map content. MapControl1.GridUnderContent = false; // Make sure parallels and latitude labels are visible. MapControl1.Parallels.Visible = true; MapControl1.Parallels.ShowLabels = true; // Set the line color to be partially transparent and apply a dashed line style. MapControl1.Parallels.LineColor = Color.FromArgb(128, Color.Magenta); MapControl1.Parallels.LineStyle = MapDashStyle.Dash; MapControl1.Parallels.LineWidth = 1; // Set the label color, font, and label position. MapControl1.Parallels.LabelColor = Color.FromArgb(128, Color.Green); MapControl1.Parallels.Font = new Font("MS Sans Serif", 8, FontStyle.Regular); MapControl1.Parallels.LabelPosition = LabelPosition.Center; // Choose a 5 degree interval for the grid. MapControl1.Parallels.Interval = 5;