GeoCoordinates.Core 1.1.2

dotnet add package GeoCoordinates.Core --version 1.1.2                
NuGet\Install-Package GeoCoordinates.Core -Version 1.1.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GeoCoordinates.Core" Version="1.1.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GeoCoordinates.Core --version 1.1.2                
#r "nuget: GeoCoordinates.Core, 1.1.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install GeoCoordinates.Core as a Cake Addin
#addin nuget:?package=GeoCoordinates.Core&version=1.1.2

// Install GeoCoordinates.Core as a Cake Tool
#tool nuget:?package=GeoCoordinates.Core&version=1.1.2                

GeoCoordinates C# Library

Summary

This lightweight and straightforward library is ideal for anyone working with coordinate data or projects involving geographical information.

Library Features

  • Coordinate: A class representing a single point in space, containing latitude, longitude, elevation, and other relevant properties.
  • CoordinatePath: A class that holds a collection of coordinates along with additional attributes such as total distance, elevation gain and loss, and more.
  • GpxHandler: A utility class for parsing and extracting data from GPX files (versions 1.0 and 1.1).

Example Use Case

Consider a scenario where you need to calculate the distance between two mountain summits.

Using this library you would do as such:

static double GetDistanceBetweenSummits(Coordinate summit1, Coordinate summit2)
{
    return summit1.GetDistanceTo(summit2);
}

var summit1 = new Coordinate(53.023, 54.024, 6565);
var summit2 = new Coordinate(54.325, 55.023, 7972);

var distance = GetDistanceBetweenSummits(summit1, summit2);

Console.WriteLine($"The distance between the summits is {distance} meters."); 

Or you need to figure out the distance of your run which u have saved as a gpx file.

var handler = new GpxHandler(new GpxProcessor() ,new GpxLoader());
var filepath = "./runs/my_fav_run.gpx";

var run = handler.LoadGpxWaypoints(filepath);

Console.WriteLine($"The distance of the run is {run.Distance} meters");

Or you need to figure out average elevation gain of your saved tracks from gpx file.

var handler = new GpxHandler(new GpxProcessor(), new GpxLoader());
var filepath = "./runs/my_fav_run.gpx";

var runs = handler.LoadGpxTracks(filepath);

var total = 0.0;

foreach (var run in runs)
{
    total += run.ElevationGain;
}

Console.WriteLine($"The average elevation gain of all your runs is {total / runs.Count()}");

Contribution

If anyone reading this wants to contribute just create a pull request. I will be happy to extend this library beyond, I've implemented only the basics for my own use. I'm sure there is a'lot of that can be done!

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.2 101 9/18/2024
1.1.0 146 8/28/2024
1.0.2 100 8/28/2024
1.0.1 100 8/28/2024
1.0.0 103 8/27/2024

Modified the Equals method to compare Coordinate objects using their string representations instead of individual properties, and updated GetHashCode to use the hash code of the string representation rather than combining individual field values.