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

Exclude GBFS vehicles/stations with invalid coordinates

parent c8e64303
......@@ -22,6 +22,7 @@
#include <QJsonDocument>
#include <QJsonObject>
#include <cmath>
#include <functional>
using namespace KPublicTransport;
......@@ -115,7 +116,7 @@ static void appendResults(const GBFSService &service, const LocationRequest &req
const auto station = stationV.toObject();
const auto lat = GBFSReader::readLatitude(station);
const auto lon = GBFSReader::readLongitude(station);
if (Location::distance(lat, lon, req.latitude(), req.longitude()) > req.maximumDistance()) {
if (std::isnan(lat) || std::isnan(lon) || Location::distance(lat, lon, req.latitude(), req.longitude()) > req.maximumDistance()) {
continue;
}
Location loc;
......@@ -162,7 +163,7 @@ static void appendResults(const GBFSService &service, const LocationRequest &req
}
const auto lat = GBFSReader::readLatitude(bike);
const auto lon = GBFSReader::readLongitude(bike);
if (Location::distance(lat, lon, req.latitude(), req.longitude()) > req.maximumDistance()) {
if (std::isnan(lat) || std::isnan(lon) || Location::distance(lat, lon, req.latitude(), req.longitude()) > req.maximumDistance()) {
continue;
}
......
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