Commit d7f702c5 authored by Volker Krause's avatar Volker Krause
Browse files

Filter out zero coordinates

While technically valid, it's a common error. Nobody is going to part a
rental vehicle in the Atlantic ocean after all. Improves the bounding box
computation in those cases.
parent b9d71e79
......@@ -285,11 +285,11 @@ void GBFSJob::computeBoundingBox(const QJsonArray &array)
for (const auto &statVal : array) {
const auto station = statVal.toObject();
const auto lat = station.value(QLatin1String("lat")).toDouble(NAN);
if (!std::isnan(lat) && lat >= -90.0 && lat <= 90.0) {
if (!std::isnan(lat) && lat >= -90.0 && lat <= 90.0 && lat != 0.0) {
lats.push_back(lat);
}
const auto lon = station.value(QLatin1String("lon")).toDouble(NAN);
if (!std::isnan(lon) && lon >= -180.0 && lon <= 180.0) {
if (!std::isnan(lon) && lon >= -180.0 && lon <= 180.0 && lon != 0.0) {
lons.push_back(lon);
}
}
......
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