package mlgpx

  1. Overview
  2. Docs

Module Gpx.RouteSource

Route data and calculations

The Route module handles planned paths represented as ordered sequences of waypoints. Routes typically represent intended journeys rather than recorded tracks. Each route can include:

  • Ordered list of waypoints (route points)
  • Route metadata (name, description, links)
  • Distance calculations between points

Route types and operations

Sourcetype point = Waypoint.t

Route point is an alias for waypoint

Sourcetype t = {
  1. name : string option;
  2. cmt : string option;
  3. desc : string option;
  4. src : string option;
  5. number : int option;
  6. type_ : string option;
  7. extensions : Extension.t list;
  8. rtepts : point list;
}

Main route type

Route Constructors

Sourceval empty : t

Create empty route

Sourceval make : name:string -> t

Create route with name

Sourceval make_from_coords : name:string -> (float * float) list -> t

Create route from coordinate list.

  • parameter name

    Route name

  • parameter coords

    List of (latitude, longitude) pairs

Route Properties

Sourceval name : t -> string option

Get route name

Sourceval description : t -> string option

Get route description

Sourceval number : t -> int option

Get route number

Sourceval comment : t -> string option

Get route comment

Sourceval source : t -> string option

Get route source

Get route links

Sourceval type_ : t -> string option

Get route type

Sourceval extensions : t -> Extension.t list

Get route extensions

Sourceval points : t -> point list

Get route points

Sourceval point_count : t -> int

Get route point count

Sourceval is_empty : t -> bool

Check if route is empty

Route Modification

Sourceval clear_points : t -> t

Clear all points

Route Analysis

Sourceval to_coords : t -> (float * float) list

Extract coordinates from route

Sourceval total_distance : t -> float

Calculate total distance between consecutive points in meters

Sourceval first_point : t -> point option

Get first point

Sourceval last_point : t -> point option

Get last point

Functional Operations

Sourceval with_name : t -> string -> t

Update name

Sourceval with_comment : t -> string -> t

Update comment

Sourceval with_description : t -> string -> t

Update description

Sourceval with_source : t -> string -> t

Update source

Sourceval with_number : t -> int -> t

Update number

Sourceval with_type : t -> string -> t

Update type

Sourceval add_point : t -> point -> t

Add point

Add link

Sourceval add_extensions : t -> Extension.t list -> t

Add extensions

Comparison and Utilities

Sourceval compare : t -> t -> int

Compare routes

Sourceval equal : t -> t -> bool

Test route equality

Sourceval pp : Format.formatter -> t -> unit

Pretty print route

OCaml

Innovation. Community. Security.