Commit 96f00577 authored by Volker Krause's avatar Volker Krause
Browse files

Round bounding box coordinates

Reduces/stabilizes the diff of gbfs-feeds.json and makes the coordinates
easier to read.
parent 101bc004
...@@ -447,6 +447,14 @@ void GBFSJob::finalize() ...@@ -447,6 +447,14 @@ void GBFSJob::finalize()
if (maxLat > minLat && maxLon > minLon) { if (maxLat > minLat && maxLon > minLon) {
m_service.boundingBox = QRectF(QPointF(minLon, minLat), QPointF(maxLon, maxLat)); m_service.boundingBox = QRectF(QPointF(minLon, minLat), QPointF(maxLon, maxLat));
} }
// round bounding box coordinates to stabilize the diff gbfs-feeds.json a bit
constexpr const auto COORD_RESOLUTION = 100.0;
m_service.boundingBox.setLeft(std::floor(m_service.boundingBox.left() * COORD_RESOLUTION) / COORD_RESOLUTION);
m_service.boundingBox.setTop(std::floor(m_service.boundingBox.top() * COORD_RESOLUTION) / COORD_RESOLUTION);
m_service.boundingBox.setRight(std::ceil(m_service.boundingBox.right() * COORD_RESOLUTION) / COORD_RESOLUTION);
m_service.boundingBox.setBottom(std::ceil(m_service.boundingBox.bottom() * COORD_RESOLUTION) / COORD_RESOLUTION);
qDebug() << "bounding box:" << m_service.boundingBox; qDebug() << "bounding box:" << m_service.boundingBox;
GBFSServiceRepository::store(m_service); GBFSServiceRepository::store(m_service);
Q_EMIT finished(); Q_EMIT finished();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment