GeoCoordinates.Core
1.1.0
See the version list below for details.
dotnet add package GeoCoordinates.Core --version 1.1.0
NuGet\Install-Package GeoCoordinates.Core -Version 1.1.0
<PackageReference Include="GeoCoordinates.Core" Version="1.1.0" />
paket add GeoCoordinates.Core --version 1.1.0
#r "nuget: GeoCoordinates.Core, 1.1.0"
// Install GeoCoordinates.Core as a Cake Addin #addin nuget:?package=GeoCoordinates.Core&version=1.1.0 // Install GeoCoordinates.Core as a Cake Tool #tool nuget:?package=GeoCoordinates.Core&version=1.1.0
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 {path.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 | Versions 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. |
-
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.
New GpxHandler.LoadGpxTracks() method for loading tracks from .gpx file.
New ToString() method for CoordinatePath class
Fixed that documentation is visible outside the project files.