Skip to main content

ResQ.Core

Location Class

Represents a geographic location with latitude, longitude, and optional altitude.
public record Location : System.IEquatable<ResQ.Core.Location>
Inheritance System.Object → Location Implements System.IEquatable<Location>

Example

var location = new Location(37.7749, -122.4194); // San Francisco
var locationWithAlt = new Location(37.7749, -122.4194, 100.5);

// Calculate distance between two locations
var sf = new Location(37.7749, -122.4194);
var la = new Location(34.0522, -118.2437);
double distanceKm = sf.DistanceTo(la); // ~559 km

Remarks

This record provides a standard way to represent geographic coordinates throughout the ResQ system. It includes a method to calculate distance between locations using the Haversine formula for great-circle distance.
Constructors
Location(double, double, Nullable<double>)Represents a geographic location with latitude, longitude, and optional altitude.
Properties
AltitudeAltitude in meters above sea level (optional).
LatitudeLatitude in decimal degrees (-90 to 90).
LongitudeLongitude in decimal degrees (-180 to 180).
Methods
DistanceTo(Location)Calculates the great-circle distance to another location using the Haversine formula.