# Converting between grid-based coordinates and geodetic coordinates

## Grid to geodetic

// Create a new GridCoordinate with a specified projection
GridCoordinate gridCoord = new GridCoordinate() { X = 7094946, Y=1693701, Projection=SwedishProjections.RT90_25GonV};
// Use the GaussKruger-algorithm to convert the GridCoordinate to a GeodeticCoordinate
GeodeticCoordinate geoCoord = GaussKruger.GridToGeodetic(gridCoord);

The result of the above calculation should yield a new GeodeticCoordinate with the values of about Latitude = 63.90786 and Longitude = 19.75247.

## Geodetic to grid

// Create a new GeodeticCoordinate
GeodeticCoordinate geoCoord = new GeodeticCoordinate() { Latitude = 63.90786d, Longitude = 19.75247d };
// Use the GaussKruger-algorithm to convert the GeodeticCoordinate to a GridCoordinate with the specified projection
GridCoordinate gridCoord = GaussKruger.GeodeticToGrid(coordinate, SwedishProjections.RT90_25GonV);

The result of the above calculation should yield a new GridCoordinate with the values of about X = 7094946 and Y = 1693701.

# Calculating distance between coordinates

// Create a pair of coordinates
GeodeticCoordinate coordinate1 = new GeodeticCoordinate() { Latitude = 63.83451d, Longitude = 20.24655d };
GeodeticCoordinate coordinate2 = new GeodeticCoordinate() { Latitude = 63.85763d, Longitude = 20.33569d };
// Calculate the distance between the coordinates using the haversine formula
double distance = DistanceCalculator.Haversine(coordinate1, coordinate2);

The result of the above calculation should be slightly over 5 kilometers.