Share |

Mercator Projection - Eye4Software GPS Toolkit

Download Eye4Software GPS Toolkit free trial Download the Eye4Software GPS Toolkit fully functional 30 day trial version for free
Browse through the Eye4Software GPS Toolkit for Windows manual Browse through the Eye4Software GPS Toolkit manual

Mercator Projection

The Mercator projection is a cylindrical map projection presented by the Flemish (Belgian) geographer and cartographer Gerardus Mercator, in 1569. It became the standard map projection for nautical purposes because of its ability to represent lines of constant course, known as rhumb lines or loxodromes, as straight segments. While the linear scale is constant in all directions around any point, thus preserving the angles and the shapes of small objects (which makes the projection conformal), the Mercator projection distorts the size and shape of large objects, as the scale increases from the Equator to the poles, where it becomes infinite.

Mercator Projection

Some projections that are derived from the Mercator projection are:

  • Mercator 1SP Projection;
  • Mercator 2SP Projection;

Required Parameters

To convert Mercator coordinates, the following parameters have to be set:

  • False Northing;
  • False Easting;
  • Central Meridian;
  • Scale Factor (1SP);
  • Standard Parallel 1 (2SP);

Eye4Software GPS Toolkit

The following code sample (VBScript) shows how to use the Mercator Projection from the Eye4Software GPS Toolkit:

' This demo translates lat/lon coordinates (WGS84) to Mercator 41 coordinates (WGS84) using
' Mercator projection
'
' This demo specifies a map grid based on the Mercator projection, by setting all geodetic parameters. 
'
' If you want to convert using one of the 4000 grids that are included in the component,
' you should have a look at the demo_gridsimple.vbs demo (recommended for users with less or no experience in geodesy).

Option Explicit

Dim objDatumSrc, objDatumDst, objGridSrc, objGridDst, objProjection, objConstants

Set objDatumSrc		= CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objDatumDst		= CreateObject ( "Eye4Software.GpsDatumParameters" )
Set objGridSrc 		= CreateObject ( "Eye4Software.GpsGridParameters" )
Set objGridDst 		= CreateObject ( "Eye4Software.GpsGridParameters" )
Set objProjection   	= CreateObject ( "Eye4Software.GpsProjection" )
Set objConstants 	= CreateObject ( "Eye4Software.GpsConstants" )

WScript.Echo "Eye4Software GPS Toolkit " & objProjection.Version & " - Mercator Projection Demo" 
WScript.Echo

' // Start of parameters part //

' Set Source Datum: WGS84
objDatumSrc.Axis		= 6378137.000
objDatumSrc.Flattening		= 298.257223563

' Set Source Grid: Latitude/Longitude
objGridSrc.Projection		= objConstants.GPS_PROJECTION_NONE
objGridSrc.Datum		= objDatumSrc

' Set Destination Datum: WGS84
objDatumDst.Axis		= 6378137.000
objDatumDst.Flattening		= 298.257223563

' Set destination grid: Miller World
objGridDst.Projection		= objConstants.GPS_PROJECTION_MERCATOR
objGridDst.Datum		= objDatumDst
objGridDst.FalseNorthing	= 0.0
objGridDst.FalseEasting		= 0.0
objGridDst.ParallelNorth	= -41.0
objGridDst.OriginLongitude	= 100.0

' Set Source coordinates
objProjection.Latitude		= -41.5
objProjection.Longitude		= 174.0

' // End of parameters part //

' Perform the transformation
WScript.Echo "Convert from Latitude / Longitude to Mercator41 using Mercator projection"
WScript.Echo
WScript.Echo "Latitude    = " & objProjection.Latitude
WScript.Echo "Longitude   = " & objProjection.Longitude
WScript.Echo

objProjection.TransformGrid objGridSrc, objGridDst

' Return the result
WScript.Echo "Result: " & objProjection.LastError & " (" & objProjection.LastErrorDescription & ")"
WScript.Echo
If ( objProjection.LastError = 0 ) Then
	WScript.Echo "Northing    = " & objProjection.Northing
	WScript.Echo "Easting     = " & objProjection.Easting
End If

WScript.Echo "Ready."

Click here to show a list of all supported map projections.