4 [![Build Status](https://travis-ci.org/mariokonrad/marnav.svg?branch=master)](https://travis-ci.org/mariokonrad/marnav)
7 Copyright (c) 2015, Mario Konrad "mario.konrad@gmx.net"
9 This is a C++11 library for MARitime NAVigation purposes.
11 It supports (partially):
12 - NMEA-0183 (sentences: AAM, ALM, APB, BOD, BWC, BWR, BWW, DBT, DPT, DSC, DSE, DTM, FSI, GBS,
13 GGA, GLC, GLL, GNS, GRS, GSA, GST, GSV, GTD, HDG, HFB, HSC, LCD, MSK, MSS, MTW, MWD, MWV, OSD,
14 RMA, RMB, RMC, ROT, RPM, RSA, RSD, RTE, SFI, TDS, TFI, TLL, TPC, TPR, TPT, TTM, VBW, VDM,
15 VDO, VDR, VHW, VLW, VTG, VWR, VPW, WCV, WNC, WPL, XDR, XTE, XTR, ZDA, ZDL, ZFO, ZTG, DBK,
17 - AIS (messages: 01, 02, 03, 04, 05, 09, 10, 11, 18, 19, 21, 24)
18 - SeaTalk (Raymarine device communication, aka SeaTalk1) (supported messages:
19 00, 01, 05, 10, 11, 20, 21, 22, 23, 24, 25, 26, 27, 30, 36, 38)
20 - Reading data from serial ports (NMEA, SeaTalk)
21 - Basic geodesic functions, suitable for martime navigation.
22 - Calculation of CPA and TCPA
23 - Distance of two points on a sphere
24 - Distance of two points on an ellipsoid using formula of Vincenty
25 - Distance of two points on an ellipsoid using formula of Lambert
27 More documentation to be found after building it, see (some are
28 optimized for doxygen not github):
30 - [Features Overview](doc/features.md)
31 - [Examples](doc/examples.md)
32 - [Development Environment](doc/devenv.md)
39 using namespace marnav;
41 auto sentence = nmea::make_sentence(
42 "$GPRMC,201034,A,4702.4040,N,00818.3281,E,0.0,328.4,260807,0.6,E,A*17");
43 std::cout << sentence->tag() << "\n";
44 auto rmc = nmea::sentence_cast<nmea::rmc>(sentence);
45 std::cout << "latitude : " << nmea::to_string(rmc->get_lat()) << "\n";
46 std::cout << "longitude: " << nmea::to_string(rmc->get_lon()) << "\n";
50 using namespace marnav;
53 const std::vector<std::string> received_strings
54 = {"!AIVDM,2,1,3,B,55P5TL01VIaAL@7WKO@mBplU@<PDhh000000001S;AJ::4A80?4i@E53,0*3E",
55 "!AIVDM,2,2,3,B,1@0000000000000,2*55"};
57 // parse NMEA sentences
58 std::vector<std::unique_ptr<nmea::sentence>> sentences;
59 for (auto const & txt : received_strings) {
60 auto sentence = nmea::make_sentence(txt);
61 if (sentence->id() == nmea::sentence_id::VDM) {
62 sentences.push_back(std::move(sentence));
66 // parse and and process AIS messags
67 auto payload = nmea::collect_payload(sentences.begin(), sentences.end());
68 auto message = ais::make_message(payload);
69 if (message->type() == ais::message_id::static_and_voyage_related_data) {
70 auto report = ais::message_cast<ais::message_05>(message);
71 std::cout << "shipname: " << report->get_shipname() << "\n";
72 std::cout << "callsign: " << report->get_callsign() << "\n";
90 cmake -DCMAKE_BUILD_TYPE=Release ..
97 See file [LICENSE](LICENSE)