GPS Exchange Format library/CLI in OCaml
1(** Main GPX document type *)
2
3(** Main GPX document type *)
4type t = {
5 version : string; (* GPX version: "1.0" or "1.1" *)
6 creator : string; (* Creating application *)
7 metadata : Metadata.t option; (* Document metadata *)
8 waypoints : Waypoint.t list; (* Waypoints *)
9 routes : Route.t list; (* Routes *)
10 tracks : Track.t list; (* Tracks *)
11 extensions : Extension.t list; (* Document-level extensions *)
12}
13
14(** Document statistics *)
15type stats = {
16 waypoint_count : int;
17 route_count : int;
18 track_count : int;
19 total_points : int;
20 has_elevation : bool;
21 has_time : bool;
22}
23
24(** {2 Document Constructors} *)
25
26(** Create empty GPX document *)
27val empty : creator:string -> t
28
29(** Create GPX document with metadata *)
30val make : creator:string -> metadata:Metadata.t -> t
31
32(** {2 Document Properties} *)
33
34(** Get version *)
35val version : t -> string
36
37(** Get creator *)
38val creator : t -> string
39
40(** Get metadata *)
41val metadata : t -> Metadata.t option
42
43(** Get waypoints *)
44val waypoints : t -> Waypoint.t list
45
46(** Get routes *)
47val routes : t -> Route.t list
48
49(** Get tracks *)
50val tracks : t -> Track.t list
51
52(** Get extensions *)
53val extensions : t -> Extension.t list
54
55(** {2 Document Modification} *)
56
57(** Update metadata *)
58val with_metadata : t -> Metadata.t -> t
59
60(** Add waypoint *)
61val add_waypoint : t -> Waypoint.t -> t
62
63(** Add waypoints *)
64val add_waypoints : t -> Waypoint.t list -> t
65
66(** Add route *)
67val add_route : t -> Route.t -> t
68
69(** Add routes *)
70val add_routes : t -> Route.t list -> t
71
72(** Add track *)
73val add_track : t -> Track.t -> t
74
75(** Add tracks *)
76val add_tracks : t -> Track.t list -> t
77
78(** Add extensions *)
79val add_extensions : t -> Extension.t list -> t
80
81(** Clear waypoints *)
82val clear_waypoints : t -> t
83
84(** Clear routes *)
85val clear_routes : t -> t
86
87(** Clear tracks *)
88val clear_tracks : t -> t
89
90(** {2 Document Analysis} *)
91
92(** Count waypoints *)
93val waypoint_count : t -> int
94
95(** Count routes *)
96val route_count : t -> int
97
98(** Count tracks *)
99val track_count : t -> int
100
101(** Count total points *)
102val total_points : t -> int
103
104(** Check if document has elevation data *)
105val has_elevation : t -> bool
106
107(** Check if document has time data *)
108val has_time : t -> bool
109
110(** Check if document is empty *)
111val is_empty : t -> bool
112
113(** Get document statistics *)
114val stats : t -> stats
115
116(** Pretty print statistics *)
117val pp_stats : Format.formatter -> t -> unit
118
119(** {2 Comparison and Utilities} *)
120
121(** Compare documents *)
122val compare : t -> t -> int
123
124(** Test document equality *)
125val equal : t -> t -> bool
126
127(** Pretty print document *)
128val pp : Format.formatter -> t -> unit