Skip to content

Commit 95e4b21

Browse files
committed
Fix lat-lon management
1 parent 1fcce77 commit 95e4b21

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/dsm/sources/RoadNetwork.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ namespace dsm {
249249
file >> lon >> lat;
250250
auto const& it{m_nodes.find(i)};
251251
if (it != m_nodes.cend()) {
252-
it->second->setCoords(std::make_pair(lon, lat));
252+
it->second->setCoords(std::make_pair(lat, lon));
253253
} else {
254254
Logger::warning(std::format("Node with id {} not found.", i));
255255
}
@@ -282,7 +282,7 @@ namespace dsm {
282282
dLat = lat == "Nan" ? 0. : std::stod(lat);
283283
auto const& it{m_nodes.find(std::stoul(nodeId))};
284284
if (it != m_nodes.cend()) {
285-
it->second->setCoords(std::make_pair(dLon, dLat));
285+
it->second->setCoords(std::make_pair(dLat, dLon));
286286
} else {
287287
Logger::warning(
288288
std::format("Node with id {} not found. Skipping coordinates ({}, {}).",
@@ -478,7 +478,7 @@ namespace dsm {
478478
for (auto const& [nodeId, pNode] : m_nodes) {
479479
file << nodeId << ';';
480480
if (pNode->coords().has_value()) {
481-
file << pNode->coords().value().first << ';' << pNode->coords().value().second;
481+
file << pNode->coords().value().second << ';' << pNode->coords().value().first;
482482
} else {
483483
file << "Nan;Nan";
484484
}

test/data/coords.dsm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
9
22
0 0
3-
1 0
4-
2 0
53
0 1
6-
1 1
7-
2 1
84
0 2
5+
1 0
6+
1 1
97
1 2
8+
2 0
9+
2 1
1010
2 2

test/data/nodes.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
id;lon;lat
2-
1;1;0
2+
1;0;1
33
0;0;0
4-
2;2;0
4+
2;0;2

0 commit comments

Comments
 (0)