Geo Location

Type-Safe Geographic Coordinates

In One Line

Geography made simple: Type-safe coordinates, human-readable results!


Overview

GeoLocation provides a robust, type-safe way to handle geographic coordinates using the WGS84 standard. It prevents common latitude/longitude errors and offers an intuitive API for working with geographic positions.


Quick Start

// Create a location using clear, semantic constructors
var tokyo = new Wgs84Location(
    Latitude.North(35.6762), 
    Longitude.East(139.6503)
);

// Alternative way using degrees (with automatic range validation)
var sydney = new Wgs84Location(
    Latitude.Degrees(-33.8688),  // South
    Longitude.Degrees(151.2093)  // East
);

Console.WriteLine(tokyo);  // Output: (35.6762° N, 139.6503° E)
Console.WriteLine(sydney); // Output: (33.8688° S, 151.2093° E)

Features

  • Type-safe coordinate handling

  • Automatic range validation

  • Clear North/South/East/West semantics

  • Human-readable string formatting

  • WGS84 compliance


Common Usage

Creating Coordinates

Range Validation


Real-World Examples

Landmark Locations

Geographic Boundary Checking


Best Practices

  • Use North/South/East/West methods for clearer code intent

  • Let the library handle coordinate validation

  • Use the built-in ToString() for human-readable output

  • Store coordinates as Wgs84Location for type safety


Notes

  • All coordinates are automatically validated and clamped to valid ranges

  • Latitude range: -90° to 90° (negative = South)

  • Longitude range: -180° to 180° (negative = West)

  • Uses WGS84 standard (compatible with GPS and most mapping systems)


Last updated