Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Libraries
KPublicTransport
Commits
1073beb1
Commit
1073beb1
authored
Oct 09, 2021
by
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
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/lib/backends/opentripplannergraphqlbackend.cpp
View file @
1073beb1
...
...
@@ -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
);
...
...
src/lib/backends/otp/entur/stationByCoordinate.graphql
View file @
1073beb1
# 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
}}
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment