Geographic coordinate handling with validation
The Coordinate module provides validated coordinate types for latitude, longitude, and degrees. All coordinates use the WGS84 datum and are validated at construction time to ensure they fall within valid ranges:
- Latitude: -90.0 to +90.0 degrees
- Longitude: -180.0 to +180.0 degrees
- Degrees: 0.0 to 360.0 degrees
Example: Coordinate.latitude 37.7749 creates a validated latitude.
Geographic coordinate types with validation
Sourcetype latitude = private float Coordinate types with validation constraints
Sourcetype longitude = private float Sourcetype degrees = private float Constructors
Create validated latitude.
Create validated longitude.
Create validated degrees.
Conversion Functions
Convert latitude to float
Convert longitude to float
Operations
Create coordinate pair from validated components
Sourceval make_from_floats : float -> float -> (t, string) result Create coordinate pair from floats with validation
Extract latitude component
Extract longitude component
Sourceval to_floats : t -> float * float Convert coordinate to float pair
Comparison and Printers