GPS Exchange Format library/CLI in OCaml
at main 4.2 kB view raw
1(** Waypoint data and GPS fix types *) 2 3(** GPS fix types as defined in GPX spec *) 4type fix_type = 5 | None_fix 6 | Fix_2d 7 | Fix_3d 8 | Dgps 9 | Pps 10 11(** Main waypoint type - shared by waypoints, route points, track points *) 12type t = { 13 lat : Coordinate.latitude; 14 lon : Coordinate.longitude; 15 ele : float option; 16 time : Ptime.t option; 17 magvar : Coordinate.degrees option; 18 geoidheight : float option; 19 name : string option; 20 cmt : string option; 21 desc : string option; 22 src : string option; 23 links : Link.t list; 24 sym : string option; 25 type_ : string option; 26 fix : fix_type option; 27 sat : int option; 28 hdop : float option; 29 vdop : float option; 30 pdop : float option; 31 ageofdgpsdata : float option; 32 dgpsid : int option; 33 extensions : Extension.t list; 34} 35 36(** {2 Fix Type Operations} *) 37 38(** Convert fix_type to string *) 39val fix_type_to_string : fix_type -> string 40 41(** Parse fix_type from string *) 42val fix_type_of_string : string -> fix_type option 43 44(** Compare fix types *) 45val compare_fix_type : fix_type -> fix_type -> int 46 47(** Pretty print fix type *) 48val pp_fix_type : Format.formatter -> fix_type -> unit 49 50(** {2 Waypoint Operations} *) 51 52(** Create waypoint with required coordinates *) 53val make : Coordinate.latitude -> Coordinate.longitude -> t 54 55(** Create waypoint from float coordinates with validation *) 56val make_from_floats : lat:float -> lon:float -> ?name:string -> ?desc:string -> unit -> (t, string) result 57 58(** Get coordinate pair *) 59val coordinate : t -> Coordinate.t 60 61(** Get latitude *) 62val lat : t -> Coordinate.latitude 63 64(** Get longitude *) 65val lon : t -> Coordinate.longitude 66 67(** Get coordinate as float pair *) 68val to_floats : t -> float * float 69 70(** Get elevation *) 71val elevation : t -> float option 72 73(** Get time *) 74val time : t -> Ptime.t option 75 76(** Get name *) 77val name : t -> string option 78 79(** Get description *) 80val description : t -> string option 81 82(** Get comment *) 83val comment : t -> string option 84 85(** Get source *) 86val source : t -> string option 87 88(** Get symbol *) 89val symbol : t -> string option 90 91(** Get type *) 92val type_ : t -> string option 93 94(** Get fix type *) 95val fix : t -> fix_type option 96 97(** Get satellite count *) 98val sat : t -> int option 99 100(** Get horizontal dilution of precision *) 101val hdop : t -> float option 102 103(** Get vertical dilution of precision *) 104val vdop : t -> float option 105 106(** Get position dilution of precision *) 107val pdop : t -> float option 108 109(** Get magnetic variation *) 110val magvar : t -> Coordinate.degrees option 111 112(** Get geoid height *) 113val geoidheight : t -> float option 114 115(** Get age of DGPS data *) 116val ageofdgpsdata : t -> float option 117 118(** Get DGPS ID *) 119val dgpsid : t -> int option 120 121(** Get links *) 122val links : t -> Link.t list 123 124(** Get extensions *) 125val extensions : t -> Extension.t list 126 127(** Functional operations for building waypoints *) 128 129(** Update elevation *) 130val with_elevation : t -> float -> t 131 132(** Update time *) 133val with_time : t -> Ptime.t option -> t 134 135(** Update name *) 136val with_name : t -> string -> t 137 138(** Update comment *) 139val with_comment : t -> string -> t 140 141(** Update description *) 142val with_description : t -> string -> t 143 144(** Update source *) 145val with_source : t -> string -> t 146 147(** Update symbol *) 148val with_symbol : t -> string -> t 149 150(** Update type *) 151val with_type : t -> string -> t 152 153(** Update fix *) 154val with_fix : t -> fix_type option -> t 155 156(** Update satellite count *) 157val with_sat : t -> int -> t 158 159(** Update HDOP *) 160val with_hdop : t -> float -> t 161 162(** Update VDOP *) 163val with_vdop : t -> float -> t 164 165(** Update PDOP *) 166val with_pdop : t -> float -> t 167 168(** Update magnetic variation *) 169val with_magvar : t -> Coordinate.degrees -> t 170 171(** Update geoid height *) 172val with_geoidheight : t -> float -> t 173 174(** Update age of DGPS data *) 175val with_ageofdgpsdata : t -> float -> t 176 177(** Update DGPS ID *) 178val with_dgpsid : t -> int -> t 179 180(** Add link *) 181val add_link : t -> Link.t -> t 182 183(** Add extensions *) 184val add_extensions : t -> Extension.t list -> t 185 186(** Compare waypoints *) 187val compare : t -> t -> int 188 189(** Test waypoint equality *) 190val equal : t -> t -> bool 191 192(** Pretty print waypoint *) 193val pp : Format.formatter -> t -> unit