Click or drag to resize

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.

Inheritance Hierarchy
SystemObject
  DHI.ProjectionsMapProjection

Namespace:  DHI.Projections
Assembly:  DHI.Projections (in DHI.Projections.dll) Version: 19.0.0.0 (11.1.1.1111)
Syntax
public class MapProjection

The MapProjection type exposes the following members.

Constructors
  NameDescription
Public methodMapProjection
Create and initialize a mapprojection with the specifed projection string.
Top
Properties
  NameDescription
Public propertyStatic memberGoogleMapProjectionString
Returns the Google Map projection string
Public propertyStatic memberLocalCoordinatesProjectionString
Public propertyName
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.

Public propertyProjectionString
Returns the WKT projection string, or one of the projection abbreviation strings.
Top
Methods
  NameDescription
Public methodStatic memberCode exampleAreIdentical
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.

Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGeo2Proj
Convert coordinates from geographical coordinates to projection coordinates
Public methodGeo2ProjRotation
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.

Public methodGeo2Xyz
Convert coordinates from geographical coordinates and height to 3D Euclidean coordinates.

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

Public methodGetConvergence
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.

Public methodStatic memberGetCoordSysType
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.

Public methodGetDefaultArea
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.

Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetOrigin
Get the geographical origin of the map projection
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberHasDatum
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.

Public methodStatic memberIsGeographical
Returns true if the projectionString projection is a geographical projection, i.e. based on spherical (lon, lat) coordinates
Public methodStatic memberIsGeoreferenced
Returns true if the projectionString projection is georeferenced, meaning that it is based on, or can convert to, geographical coordinates (longitude, latitude).
Public methodStatic memberIsLocal
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"

Public methodStatic memberIsLongLat
Returns true if the projectionString projection is "LONG/LAT"

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

Public methodStatic memberIsValid
Returns true if the projectionString is a valid projection string
Public methodStatic memberLongitude2UtmZone
Get the projection string for the UTM zone best matching the longitude coordinate
Public methodProj2Geo
Convert coordinates from projection coordinates to geographical coordinates
Public methodProj2GeoRotation
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.

Public methodStatic memberProjectionOrigin(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.

Public methodStatic memberProjectionOrigin(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.

Public methodStatic memberProjectionShortName
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.

Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodXyz2Geo
Convert coordinates from Euclidean 3D coordinates to geographical coordinates and height.

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

Top
Examples
// 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);
See Also