10 #include "io/mm_writer.hpp"
11 #include "util/util.hpp"
12 #include "util/debug.hpp"
13 #include "config/result_config.hpp"
23 m_fstream(result_file), config_(config_arg) {
28 std::string header =
"id";
37 if (config_.
write_ep) header +=
";ep";
38 if (config_.
write_tp) header +=
";tp";
40 m_fstream << header <<
'\n';
44 std::stringstream buf;
47 buf <<
";" << result.
opath;
53 for (
int i = 0; i < N - 1; ++i) {
63 for (
int i = 0; i < N - 1; ++i) {
73 for (
int i = 0; i < N - 1; ++i) {
84 for (
int i = 0; i < N; ++i) {
93 buf <<
";" << result.
cpath;
97 if (!result.
cpath.empty()) {
100 for (
int j = 0; j < J - 1; ++j) {
103 for (
int i = a; i < b; ++i) {
104 buf << result.
cpath[i];
107 buf << result.
cpath[b];
116 buf <<
";" << result.
mgeom;
122 for (
int i = 0; i < N - 1; ++i) {
132 for (
int i = 0; i < N - 1; ++i) {
142 SPDLOG_TRACE(
"Write length {}",N);
143 for (
int i = 0; i < N - 1; ++i) {
154 m_fstream << buf.rdbuf();
bool write_tpath
if true, tpath (the path traversed between each two consecutive observations) will be exported
bool write_ep
if true, ep (emission proability of each point) will be exported
void add_point(double x, double y)
Add a point to the end of the current line.
void write_result(const FMM::MM::MatchResult &result)
Write match result.
bool write_spdist
if true, spdist (the distance traversed between each two consecutive points) will be exported
bool write_tp
if true, tp (transition probability) will be exported
Map matched result representation.
void write_header()
Write a header line for the fields exported.
bool write_length
if true, length (length of each matched edge) will be exported
C_Path cpath
the complete path, containing ids of a sequence of topologically connected edges traversed by the tra...
CORE::LineString mgeom
the geometry of the matched path
int id
id of the trajectory to be matched
bool write_mgeom
if true, mgeom (the geometry of the matched path) will be exported
bool write_cpath
if true, cpath (a list of edge ID representing the matched path) will be exported
Linestring geometry class.
MatchedCandidatePath opt_candidate_path
A vector of candidate matched to each point of a trajectory.
O_Path opath
the optimal path, containing id of edges matched to each point in a trajectory
bool write_opath
if true, opath (edge id matched for each point) will be exported
std::vector< int > indices
index of opath edge in cpath
bool write_error
if true, gps error (distance from GPS point to the matched point) will be exported
CSVMatchResultWriter(const std::string &result_file, const CONFIG::OutputConfig &config_arg)
Constructor.
Output configuration class defining the fields exported for map matching.
boost::geometry::model::point< double, 2, boost::geometry::cs::cartesian > Point
Point class.
bool write_pgeom
if true, pgeom (a linestring connecting the matched point) will be exported
bool write_offset
if true, offset (distance to the start point of a matched edge) will be exported