Soenneker.Dtos.Coordinates 11.0.27

Prefix Reserved
dotnet add package Soenneker.Dtos.Coordinates --version 11.0.27
                    
NuGet\Install-Package Soenneker.Dtos.Coordinates -Version 11.0.27
                    
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.Dtos.Coordinates" Version="11.0.27" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Dtos.Coordinates" Version="11.0.27" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Dtos.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.Dtos.Coordinates --version 11.0.27
                    
#r "nuget: Soenneker.Dtos.Coordinates, 11.0.27"
                    
#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.Dtos.Coordinates@11.0.27
                    
#: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.Dtos.Coordinates&version=11.0.27
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Dtos.Coordinates&version=11.0.27
                    
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.Dtos.Coordinates

Defines an immutable WGS84 latitude/longitude value with JSON mapping, bounds inspection, and invariant formatting.

Installation

dotnet add package Soenneker.Dtos.Coordinates

Usage

using Soenneker.Dtos.Coordinates;

var chicago = new Coordinate(
    latitude: 41.8781,
    longitude: -87.6298);

if (!chicago.IsValid)
{
    throw new InvalidOperationException("Coordinate is outside WGS84 bounds.");
}

string text = chicago.ToString(); // 41.8781, -87.6298

Constructor and formatted output order is latitude first, longitude second. GeoJSON coordinate arrays use longitude first, so swap deliberately when adapting to or from GeoJSON.

Validation

IsValid is true when latitude is between -90 and 90 and longitude is between -180 and 180, inclusive. NaN and infinity are invalid. Construction and deserialization do not reject invalid values; inspect IsValid at the boundary where invalid coordinates must be refused.

default(Coordinate) represents 0, 0 and is valid. Do not use the default value as an “unset” sentinel; use Coordinate? when absence must be represented.

Serialization and formatting

System.Text.Json serializes the value as:

{
  "latitude": 41.8781,
  "longitude": -87.6298
}

IsValid is ignored by System.Text.Json.

ToString() always uses invariant culture and produces latitude, longitude. The ISpanFormattable overload applies the same numeric format and provider to both values:

string rounded = chicago.ToString("F2", CultureInfo.InvariantCulture);
// 41.88, -87.63

Span<char> buffer = stackalloc char[64];
bool formatted = chicago.TryFormat(buffer, out int written, "F4", CultureInfo.InvariantCulture);

When the destination is too small, TryFormat returns false and sets written to zero.

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.
  • net11.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Soenneker.Dtos.Coordinates:

Package Downloads
Soenneker.Geo.Coordinates

High-performance geographic coordinate utilities.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.27 143 11/18/2026
11.0.26 254 11/11/2026
11.0.25 400 10/26/2026
4.0.24 267 10/14/2026
4.0.23 120 10/14/2026
4.0.21 126 10/13/2026
4.0.18 107 10/12/2026
4.0.17 117 10/12/2026
4.0.16 134 10/11/2026
4.0.15 236 9/30/2026
4.0.14 157 9/24/2026
4.0.13 262 9/15/2026
4.0.12 181 9/12/2026
4.0.11 228 9/7/2026
4.0.10 234 8/30/2026
4.0.8 321 8/18/2026
4.0.7 365 7/27/2026
4.0.6 363 7/16/2026
4.0.5 568 6/19/2026
4.0.4 374 6/5/2026
Loading failed

Configure .NET CI defaults and daily source scans