MapProjection Class

A map projection handles conversion from geographical coordinates (lon, lat) to projection coordintes (east, north) and to Euclidean 3D datum coordinates with origin in the center of the earch (center of the ellipsoid).

The ProjectionString is a WKT string for a spatial reference system. A number of abbreviated strings also exists, i.e., "UTM-33" for a WGS-84 UTM zone 33 projection.

Definition

Namespace: DHI.Projections
Assembly: DHI.Projections (in DHI.Projections.dll) Version: 24.0.0.0 (11.1.1.1111)
C#
public class MapProjection
Inheritance
Object    MapProjection

Example

// WKT projection string string projStr = @"PROJCS[""NZGD_2000_New_Zealand_Transverse_Mercator"",GEOGCS[""GCS_NZGD_2000"",DATUM[""D_NZGD_2000"",SPHEROID[""GRS_1980"",6378137.0,298.257222101]],PRIMEM[""Greenwich"",0.0],UNIT[""Degree"",0.0174532925199433]],PROJECTION[""Transverse_Mercator""],PARAMETER[""False_Easting"",1600000.0],PARAMETER[""False_Northing"",10000000.0],PARAMETER[""Central_Meridian"",173.0],PARAMETER[""Scale_Factor"",0.9996],PARAMETER[""Latitude_Of_Origin"",0.0],UNIT[""Meter"",1.0]]"; MapProjection mapProj = new MapProjection(projStr); // Convert from projection to geographical coordinates. double lon, lat; mapProj.Proj2Geo(1752001, 5947201, out lon, out lat);

Constructors

MapProjection Create and initialize a mapprojection with the specifed projection string.

Properties

GoogleMapProjectionString Returns the Google Map projection string
LocalCoordinatesProjectionString 
Name The short name of a projection.

The short name is not unique amongst all WKT projections

If the ProjectionString is not a WKT projection string, the ProjectionString itself is returned as the short name.

ProjectionString Returns the WKT projection string, or one of the projection abbreviation strings.

Methods

AreIdentical Function that checks if two projecions are identical.

Two map projections are identical, if they have the same set of parameters. if just one of the parameters are different, then the map projections are NOT identical.

EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Geo2Proj Convert coordinates from geographical coordinates to projection coordinates
Geo2ProjRotation Convert a rotation from true north into a rotation from map projection north

It subtracts the convergence value from the true north rotation value

The convertion depends on the geographical location.

Geo2Xyz Convert coordinates from geographical coordinates and height to 3D Euclidean coordinates.

The 3D coordinate system origin is at the earth center (ellipsoid center)

GetConvergence Get the convergence (orientation towards true north) at the given geographical location.

The convergence is the angle measured clockwise from true north to the north-south gridline passing through the specified coordinate.

GetCoordSysType Function that returns the coordinate system type.

Use this function check the type of coordinate system e.g. east/north or some other combination. A typical application of this function is to exclude coordinate systems, that are not standard east/north-oriented.

GetDefaultArea Function that returns the default area in map projection coordinates of the projection.

The default area is the area where the projection is ment to be used and where it is accurate. It is not recommended to use the map projection outside its default area.

GetHashCodeServes as the default hash function.
(Inherited from Object)
GetOrigin Get the geographical origin of the map projection
GetTypeGets the Type of the current instance.
(Inherited from Object)
HasDatum Returns true if the projectionString projection has a datum definition.

If a projection does not have an underlying datum, reprojections including datum shifts cannot be performed.

IsGeographical Returns true if the projectionString projection is a geographical projection, i.e. based on spherical (lon, lat) coordinates
IsGeoreferenced Returns true if the projectionString projection is georeferenced, meaning that it is based on, or can convert to, geographical coordinates (longitude, latitude).
IsLocal Returns true if the projectionString defines a local coordinate system that is not georeferenced.

The projection string for a local coordinate system is the string: "NON-UTM"

IsLongLat Returns true if the projectionString projection is "LONG/LAT"

"LONG/LAT" is a geographical coordinate system without an underlying datum (ellipsoid) definition.

IsValid Returns true if the projectionString is a valid projection string
Longitude2UtmZone Get the projection string for the UTM zone best matching the longitude coordinate
Proj2Geo Convert coordinates from projection coordinates to geographical coordinates
Proj2GeoRotation Convert a rotation from map projection north into a rotation from true north.

It adds the convergence value to the projection north rotation value

The convertion depends on the geographical location.

ProjectionOrigin(String, Double, Double) Returns the geographical origin of the projection defined by the projstring

If the projection string is not a valid WKT string, an exception is thrown.

ProjectionOrigin(String, Double, Double, Boolean) Returns the geographical origin of the projection defined by the projstring

If the projection string is not a valid WKT string, an exception is thrown.

ProjectionShortName Get the short name out of a WKT projetion string.

The short name is not unique amongst all WKT projections

If the projString is not a WKT projection string, the projString itself is returned as the short name.

ToStringReturns a string that represents the current object.
(Inherited from Object)
Xyz2Geo Convert coordinates from Euclidean 3D coordinates to geographical coordinates and height.

The 3D coordinate system origin is at the earth center (ellipsoid center)

See Also