Table of Contents

Struct Coordinates

Namespace
XENBIT.ResQueServe.Abstractions.DataStructures
Assembly
RQS.Abstractions.dll
public readonly struct Coordinates : IComparable<Coordinates>, IComparable, IEquatable<Coordinates>
Implements
Inherited Members

Constructors

Coordinates(double, double)

[JsonConstructor]
public Coordinates(double latitude, double longitude)

Parameters

latitude double
longitude double

Properties

Latitude

public double Latitude { get; }

Property Value

double

Longitude

public double Longitude { get; }

Property Value

double

Methods

CompareTo(object?)

public int CompareTo(object? obj)

Parameters

obj object

Returns

int

CompareTo(Coordinates)

public int CompareTo(Coordinates other)

Parameters

other Coordinates

Returns

int

DistanceTo(Coordinates)

Calculates the distance in meters between this coordinate and another using the Haversine formula.

public double DistanceTo(Coordinates other)

Parameters

other Coordinates

Returns

double

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

Equals(Coordinates)

public bool Equals(Coordinates other)

Parameters

other Coordinates

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

GetOpenStreetMapUrl()

Gets the OpenStreetMap URL to show the coordinates on a map.

public string GetOpenStreetMapUrl()

Returns

string

IsValid()

Determines whether the current coordinates (latitude and longitude) are valid.

public bool IsValid()

Returns

bool

true if the coordinates are within the valid range; otherwise, false.

Remarks

The method checks if both latitude and longitude are not zero. It then verifies that latitude is between -90 and 90 degrees, and longitude is between -180 and 180 degrees.

ToString()

public override string ToString()

Returns

string