output all GeoJSON as WGS84 to be RFC 7946 conform

This commit is contained in:
Patrick Brosi 2019-07-23 22:47:35 +02:00
parent 27da2a9c9e
commit feacae92ef
9 changed files with 5369 additions and 4282 deletions

View file

@ -257,7 +257,7 @@ int main(int argc, char** argv) {
util::geo::output::GeoGraphJsonOutput out;
mkdir(cfg.dbgOutputPath.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
std::ofstream fstr(cfg.dbgOutputPath + "/graph.json");
out.print(*shapeBuilder.getGraph(), fstr);
out.printLatLng(*shapeBuilder.getGraph(), fstr);
fstr.close();
}
@ -270,9 +270,7 @@ int main(int argc, char** argv) {
auto l = shapeBuilder.shapeL(singleTrip);
// reproject to WGS84 to match RFC 7946
for (auto& p : l) {
p = util::geo::webMercToLatLng<double>(p.getX(), p.getY());
}
o.printLatLng(l, {});
o.flush();
pstr.close();
@ -288,7 +286,7 @@ int main(int argc, char** argv) {
LOG(INFO) << "Outputting trgraph" + filePost + ".json...";
mkdir(cfg.dbgOutputPath.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
std::ofstream fstr(cfg.dbgOutputPath + "/trgraph" + filePost + ".json");
out.print(ng, fstr);
out.printLatLng(ng, fstr);
fstr.close();
}
} catch (const xml::XmlFileException& ex) {

View file

@ -107,12 +107,12 @@ double Collector::add(const Trip* t, const Shape* oldS, const Shape& newS,
LINE newLCut;
for (auto oldL : oldSegs) {
gjout.print(oldL, util::json::Dict{{"ver", "old"}});
gjout.printLatLng(oldL, util::json::Dict{{"ver", "old"}});
oldLCut.insert(oldLCut.end(), oldL.begin(), oldL.end());
}
for (auto newL : newSegs) {
gjout.print(newL, util::json::Dict{{"ver", "new"}});
gjout.printLatLng(newL, util::json::Dict{{"ver", "new"}});
newLCut.insert(newLCut.end(), newL.begin(), newL.end());
}

View file

@ -57,6 +57,7 @@ struct RoutingOpts {
bool noSelfHops;
};
// _____________________________________________________________________________
inline bool operator==(const RoutingOpts& a, const RoutingOpts& b) {
return fabs(a.fullTurnPunishFac - b.fullTurnPunishFac) < 0.01 &&
fabs(a.fullTurnAngle - b.fullTurnAngle) < 0.01 &&
@ -106,22 +107,27 @@ struct EdgeCost {
double getValue() const { return _cost; }
};
// _____________________________________________________________________________
inline EdgeCost operator+(const EdgeCost& a, const EdgeCost& b) {
return EdgeCost(a.getValue() + b.getValue());
}
// _____________________________________________________________________________
inline bool operator<=(const EdgeCost& a, const EdgeCost& b) {
return a.getValue() <= b.getValue();
}
// _____________________________________________________________________________
inline bool operator==(const EdgeCost& a, const EdgeCost& b) {
return a.getValue() == b.getValue();
}
// _____________________________________________________________________________
inline bool operator>(const EdgeCost& a, const EdgeCost& b) {
return a.getValue() > b.getValue();
}
// _____________________________________________________________________________
template <typename F>
inline bool angSmaller(const Point<F>& f, const Point<F>& m, const Point<F>& t,
double ang) {
@ -152,6 +158,7 @@ typedef std::vector<EdgeListHop> EdgeListHops;
typedef std::set<Route::TYPE> MOTs;
// _____________________________________________________________________________
inline MOTs motISect(const MOTs& a, const MOTs& b) {
MOTs ret;
for (auto mot : a)
@ -159,6 +166,7 @@ inline MOTs motISect(const MOTs& a, const MOTs& b) {
return ret;
}
// _____________________________________________________________________________
inline pfaedle::router::FeedStops writeMotStops(const pfaedle::gtfs::Feed* feed,
const MOTs mots,
const std::string& tid) {
@ -183,6 +191,7 @@ inline pfaedle::router::FeedStops writeMotStops(const pfaedle::gtfs::Feed* feed,
return ret;
}
// _____________________________________________________________________________
inline std::string getMotStr(const MOTs& mots) {
bool first = false;
std::string motStr;

View file

@ -130,7 +130,7 @@ EdgeListHops ShapeBuilder::route(const router::NodeCandRoute& ncr,
LOG(INFO) << "Outputting combgraph.json...";
std::ofstream pstr(_cfg.dbgOutputPath + "/combgraph.json");
GeoGraphJsonOutput o;
o.print(g, pstr);
o.printLatLng(g, pstr);
}
return ret;