Commit 1073beb1 authored by Volker Krause's avatar Volker Krause
Browse files

Extend Entur coordinate-based location query to also support rental bikes

Also much closer to the OTP2 variant now.
parent 0e73906f
Pipeline #87300 passed with stage
in 1 minute and 17 seconds
......@@ -59,10 +59,10 @@ bool OpenTripPlannerGraphQLBackend::queryLocation(const LocationRequest &req, Lo
gqlReq.setVariable(QStringLiteral("maxResults"), req.maximumResults());
QJsonArray placeTypeFilter;
if (req.types() & Location::Stop) {
placeTypeFilter.push_back(QStringLiteral("STOP"));
placeTypeFilter.push_back(m_apiVersion == QLatin1String("entur") ? QStringLiteral("stopPlace") : QStringLiteral("STOP"));
}
if (req.types() & (Location::RentedVehicleStation | Location::RentedVehicle)) {
placeTypeFilter.push_back(QStringLiteral("BICYCLE_RENT"));
placeTypeFilter.push_back(m_apiVersion == QLatin1String("entur") ? QStringLiteral("bicycleRent") : QStringLiteral("BICYCLE_RENT"));
}
// TODO: also supports BIKE_PARK, CAR_PARK
gqlReq.setVariable(QStringLiteral("placeType"), placeTypeFilter);
......
# SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
# SPDX-License-Identifier: CC0-1.0
query stopsByCoordinate($lat: Float!, $lon: Float!) {
stopsByRadius: quaysByRadius(latitude: $lat, longitude: $lon, radius: 1000) {
query stopsByCoordinate(
$lat: Float!
$lon: Float!
$radius: Int!
$maxResults: Int!
$placeType: [FilterPlaceType]!
) {
stopsByRadius: nearest(
latitude: $lat
longitude: $lon
maximumDistance: $radius
maximumResults: $maxResults
filterByPlaceTypes: $placeType
) {
edges {
node {
stop: quay {
stop: place { ...on StopPlace {
id
name
lat: latitude
lon: longitude
timezone
parentStation: stopPlace {
parentStation: parent {
id
name
lat: latitude
lon: longitude
timezone
}
}
}}
bikeRentalStation: place { ...on BikeRentalStation {
id
name
lat: latitude
lon: longitude
networks
bikesAvailable
spacesAvailable
}}
}
}
}
......
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