output all GeoJSON as WGS84 to be RFC 7946 conform
This commit is contained in:
parent
27da2a9c9e
commit
feacae92ef
9 changed files with 5369 additions and 4282 deletions
|
|
@ -16,6 +16,20 @@ Line<T> GeoGraphJsonOutput::createLine(const util::geo::Point<T>& a,
|
|||
template <typename N, typename E>
|
||||
void GeoGraphJsonOutput::print(const util::graph::Graph<N, E>& outG,
|
||||
std::ostream& str) {
|
||||
printImpl(outG, str, false);
|
||||
}
|
||||
|
||||
// _____________________________________________________________________________
|
||||
template <typename N, typename E>
|
||||
void GeoGraphJsonOutput::printLatLng(const util::graph::Graph<N, E>& outG,
|
||||
std::ostream& str) {
|
||||
printImpl(outG, str, true);
|
||||
}
|
||||
|
||||
// _____________________________________________________________________________
|
||||
template <typename N, typename E>
|
||||
void GeoGraphJsonOutput::printImpl(const util::graph::Graph<N, E>& outG,
|
||||
std::ostream& str, bool proj) {
|
||||
GeoJsonOutput _out(str);
|
||||
|
||||
// first pass, nodes
|
||||
|
|
@ -30,7 +44,11 @@ void GeoGraphJsonOutput::print(const util::graph::Graph<N, E>& outG,
|
|||
auto addProps = n->pl().getAttrs();
|
||||
props.insert(addProps.begin(), addProps.end());
|
||||
|
||||
_out.print(*n->pl().getGeom(), props);
|
||||
if (proj) {
|
||||
_out.printLatLng(*n->pl().getGeom(), props);
|
||||
} else {
|
||||
_out.print(*n->pl().getGeom(), props);
|
||||
}
|
||||
}
|
||||
|
||||
// second pass, edges
|
||||
|
|
@ -50,11 +68,19 @@ void GeoGraphJsonOutput::print(const util::graph::Graph<N, E>& outG,
|
|||
auto a = *e->getFrom()->pl().getGeom();
|
||||
if (e->getTo()->pl().getGeom()) {
|
||||
auto b = *e->getTo()->pl().getGeom();
|
||||
_out.print(createLine(a, b), props);
|
||||
if (proj) {
|
||||
_out.printLatLng(createLine(a, b), props);
|
||||
} else {
|
||||
_out.print(createLine(a, b), props);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_out.print(*e->pl().getGeom(), props);
|
||||
if (proj) {
|
||||
_out.printLatLng(*e->pl().getGeom(), props);
|
||||
} else {
|
||||
_out.print(*e->pl().getGeom(), props);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue