Soenneker.Geo.Coordinates 11.0.43

Prefix Reserved
dotnet add package Soenneker.Geo.Coordinates --version 11.0.43
                    
NuGet\Install-Package Soenneker.Geo.Coordinates -Version 11.0.43
                    
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="Soenneker.Geo.Coordinates" Version="11.0.43" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Geo.Coordinates" Version="11.0.43" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Geo.Coordinates" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Geo.Coordinates --version 11.0.43
                    
#r "nuget: Soenneker.Geo.Coordinates, 11.0.43"
                    
#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.
#:package Soenneker.Geo.Coordinates@11.0.43
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Geo.Coordinates&version=11.0.43
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Geo.Coordinates&version=11.0.43
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Geo.Coordinates

High-performance geographic coordinate utilities.

Install

dotnet add package Soenneker.Geo.Coordinates

Parse and normalize

using Soenneker.Geo.Coordinates;
using Soenneker.Dtos.Coordinates;

if (CoordinateUtil.TryParse("40.7128, -74.0060", out Coordinate newYork))
{
    bool valid = CoordinateUtil.IsValid(newYork);
}

Coordinate normalized = CoordinateUtil.Normalize(new Coordinate(95, 181));
// 90, -179

Parsing uses invariant culture and requires latitude, longitude in WGS84 bounds. Normalize clamps latitude to [-90, 90] and wraps finite longitude to (-180, 180]; it is not a validation substitute when rejecting bad input matters.

Distance and navigation

var newYork = new Coordinate(40.7128, -74.0060);
var losAngeles = new Coordinate(34.0522, -118.2437);

double kilometers = CoordinateUtil.GetDistanceKilometers(newYork, losAngeles);
double initialBearing = CoordinateUtil.GetInitialBearingDegrees(newYork, losAngeles);

Coordinate destination = CoordinateUtil.GetDestination(
    origin: newYork,
    distanceMeters: 10_000,
    bearingDegrees: 90);

Distance, bearing, midpoint, destination, and bounding-box calculations use a spherical Earth with a mean radius of 6,371,008.8 meters. They are appropriate for general geographic work, not survey-grade ellipsoidal calculations.

Find nearest or furthest

Coordinate? closest = CoordinateUtil.GetClosest(newYork,
[
    new Coordinate(40.7357, -74.1724),
    losAngeles
]);

Sequence and ReadOnlySpan<T> overloads are available, including selector overloads that return the original item. Empty inputs return null for Coordinate and default for generic results; ties keep the first candidate.

API summary

API What it does Result / important behavior
CoordinateUtil.IsValid(latitude, longitude) Determines whether latitude and longitude are finite and within WGS84 bounds. true if latitude and longitude are finite and within WGS84 bounds; otherwise, false.
CoordinateUtil.IsValid(coordinate) Determines whether the coordinate is finite and within WGS84 bounds. true if the coordinate is finite and within WGS84 bounds; otherwise, false.
CoordinateUtil.ClampLatitude(latitude) Clamps latitude to [-90, 90]. The resulting value.
CoordinateUtil.NormalizeLongitude(longitude) Normalizes longitude to [-180, 180]. The resulting value.
CoordinateUtil.Normalize(coordinate) Clamps latitude and normalizes longitude. The resulting coordinate.
CoordinateUtil.TryParse(value, coordinate) Attempts to parse an invariant "latitude, longitude" value. true if the requested update was applied; otherwise, false.
CoordinateUtil.Parse(value) Parses an invariant "latitude, longitude" value. The resulting coordinate.
CoordinateUtil.ToRadians(degrees) Converts degrees to radians. The resulting value.
CoordinateUtil.ToDegrees(radians) Converts radians to degrees. The resulting value.
CoordinateUtil.GetDistanceMeters(from, to) Calculates the great-circle distance in meters using the haversine formula. The resulting value.
CoordinateUtil.GetDistanceKilometers(from, to) Calculates the great-circle distance in kilometers using the haversine formula. The resulting value.
CoordinateUtil.GetDistanceMiles(from, to) Calculates the great-circle distance in miles using the haversine formula. The resulting value.
CoordinateUtil.GetInitialBearingDegrees(from, to) Calculates the initial bearing from one coordinate to another in degrees, normalized to [0, 360). The resulting value.
CoordinateUtil.GetDestination(origin, distanceMeters, bearingDegrees) Calculates the coordinate reached from the origin by travelling a distance at a bearing. The resulting coordinate.
CoordinateUtil.GetMidpoint(first, second) Calculates the geographic midpoint between two coordinates. The resulting coordinate.
CoordinateUtil.GetBoundingBox(center, radiusMeters) Calculates a bounding box around a center coordinate and radius. The resulting (Coordinate Southwest, Coordinate Northeast).
CoordinateUtil.GetClosest(origin, candidates) Gets the closest coordinate to an origin from a sequence of candidates. The requested coordinate.
CoordinateUtil.GetClosest(origin, candidates, coordinateSelector) Gets the item with the closest coordinate to an origin from a sequence of candidates. The requested value.
CoordinateUtil.GetFurthest(...) Gets the coordinate or selected item furthest from the origin. null/default for an empty input.

Important behavior

  • Calculation methods reject non-finite or out-of-range coordinates with ArgumentOutOfRangeException.
  • Negative or non-finite distances/radii and non-finite bearings are rejected.
  • A bounding box that crosses the antimeridian can have a southwest longitude numerically greater than its northeast longitude; split that range when querying stores that do not understand wrapped longitude intervals.
  • The initial bearing for identical points is returned as 0, although a bearing is geometrically undefined in that case.
Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
11.0.43 86 11/11/2026
11.0.42 87 11/11/2026
11.0.41 117 10/27/2026
11.0.40 105 10/26/2026
11.0.39 103 10/26/2026
4.0.37 128 10/14/2026
4.0.36 94 10/14/2026
4.0.35 99 10/14/2026
4.0.34 95 10/14/2026
4.0.27 98 10/12/2026
4.0.24 95 10/12/2026
4.0.23 95 10/11/2026
4.0.22 119 9/30/2026
4.0.21 114 9/24/2026
4.0.20 101 9/24/2026
4.0.19 129 9/15/2026
4.0.18 124 9/15/2026
4.0.17 114 9/12/2026
4.0.16 126 9/12/2026
4.0.15 176 9/7/2026
Loading failed

Updated Multiple NuGet packages