Posts: 1
Joined: Sat Mar 12, 2011 7:37 pm

Can you confirm this is incorrect?

Sat Mar 12, 2011 8:03 pm


I am trying to use GPS Tools to convert multiple coordinates from a range of different coordinate systems to Lat/Longs. We were simply plugging in Easting/Northing, Grid and Datum and retrieving the Lat/Long. However, I suspect that the Lat/Long we were retrieving was for the Datum given for the source coordiates we are transforming from. What would we need to do to the following code to transform the coordinates to Lat/Long with a datum of GDA94?


Below is the code we currently have;

public void Transform(double easting, double northing, double relativeLevel, string datum, string projection,
int zone, out double latitude, out double longitude, out double altitude)
// Find the Franson Datum or Custom Datum that matches the datum used in the MRT file
GpsToolsNET.Datum fransonDatum;
GpsToolsNET.CustomDatum customDatum;
bool isCustomDatum;
DatumLookup(datum, out fransonDatum, out customDatum, out isCustomDatum);

// Find the Franson Grid or Custom Grid that matches the projection used in the MRT file
GpsToolsNET.Grid fransonGrid;
GpsToolsNET.CustomGrid customGrid;
bool isCustomGrid;

GridLookup(projection, zone, out fransonGrid, out customGrid, out isCustomGrid);

GpsToolsNET.Position pos = new GpsToolsNET.Position();

// set the coords grid
if (isCustomGrid)
if (isCustomDatum)
customGrid.CustomDatum = customDatum;
customGrid.Datum = fransonDatum;
pos.CustomGrid = customGrid;
// set the coords datum
if (isCustomDatum)
pos.CustomDatum = customDatum;
pos.Datum = fransonDatum;
pos.Grid = fransonGrid;

pos.Zone = zone.ToString();

// set the position of the coord
pos.Easting = easting;
pos.Northing = northing;
pos.SetAltitude((double)relativeLevel, 1);

// return the transformed lat/long and altitude
latitude = pos.Latitude;
longitude = pos.Longitude;
altitude = pos.Altitude(1);
catch (Exception ex)
throw new ServiceException(string.Format("There was an error transforming coord ({0},{1},{2}) from ({3},{4}) to a lat/long. Details are;\n" + ex.Message ,
new string[] {easting.ToString(),northing.ToString(),relativeLevel.ToString(),datum,projection}),ex);

Return to “GpsTools”