- 3 minutes to read
This document explains why map projections are important to geographic maps. It also lists their supported types, and details how to create specialized projections in the map control.
There are numerous ways to depict the Earth's surface on a map. Depending on the selection, the surface can be drawn as a circle, a rectangle, an oval, etc.
Map projections provide numerous methods of representing a spherical surface, or any other three-dimensional body, on a plane. Each map projection distorts the surface in some way. For instance, the distortion of the Mercator projection increases away from the Equator, and is extreme in the polar regions. Thus, it is difficult to say which projection is the best. The best solution is to choose a projection that meets your specific requirements.
For more information, see Map projection.
The following table contains the predefined projections provided by the Map control for WinForms and their previews:
Also, It's possible to implement custom projections. The following example shows how to get a Hammer-Aitoff projection as a special case of the map custom projection.
There are two ways to customize a map projection used in an application: create a custom ProjectionBase class descendant that specifies a custom map projection, or configure the width/height ratio for the one of the predefined map projections.
To create a custom projection class do the following.
- Inherit a ProjectionBase class;
- Override the ProjectionBase.GeoPointToMapUnit and ProjectionBase.MapUnitToGeoPoint methods, which specify formulas to calculate custom projection coordinates and map geographical points (longitude and latitude);
- Override the ProjectionBase.GeoToKilometersSize and ProjectionBase.KilometersToGeoSize methods to convert the specified size in geographical points to the corresponding size in kilometers for the specified anchor point, and vice versa.
For example, the following image demonstrates the World map represented using the Hammer-Aitoff projection.
To specify the width/height ratio for a map projection, do the following:
- Create one of the objects listed above (for instance, EqualAreaProjection) and assign it to the GeoMapCoordinateSystem.Projection property of MapControl.CoordinateSystem;
- Specify the map size based on width/height aspect ratio for this projection using the MapControl.InitialMapSize property. For instance, you can find the width/height aspect ratio values for the cylindrical equal-area projection in the following article: Cylindrical equal-area projection.
The table below shows specializations of the cylindrical equal-area projection.
Projection Name (Width/Height Ratio) Projection Preview Lambert (3.14) Behrmann (2.36) Trystan Edwards (2) Gall-Peters (1.57) Balthasart (1.3)
The following examples demonstrate how to use predefined projections, create custom map projections and customize width/height ratio of projections.
- How to: Specify a Map Projection
- How to: Implement a Custom Map Projection
- How to: Specify the Width-to-Height Ratio of Map Projection