[gnome-maps/wip/mlundblad/use-country-code-from-photon] transitRouter: Use country code from place
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/use-country-code-from-photon] transitRouter: Use country code from place
- Date: Mon, 26 Apr 2021 21:36:17 +0000 (UTC)
commit d9a22cf05db87c4c15168d1b6d151964901a6a2a
Author: Marcus Lundblad <ml update uu se>
Date: Mon Apr 26 23:34:23 2021 +0200
transitRouter: Use country code from place
Use the country code from places in the query
when avaible, before falling back to using
libgweather to guess country/region based on
coordinates.
src/transitRouter.js | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/transitRouter.js b/src/transitRouter.js
index 4bc4ceea..0f3892bd 100644
--- a/src/transitRouter.js
+++ b/src/transitRouter.js
@@ -126,8 +126,10 @@ var TransitRouter = class TransitRoute {
return null;
}
- _getMatchingProvidersForLocation(location) {
- let country = Utils.getCountryCodeForCoordinates(location.latitude,
+ _getMatchingProvidersForPlace(place) {
+ let location = place.location;
+ let country = place.country_code ??
+ Utils.getCountryCodeForCoordinates(location.latitude,
location.longitude);
let matchingProviders = [];
@@ -191,14 +193,13 @@ var TransitRouter = class TransitRoute {
* or null if no matching provider was found.
*/
_getBestProviderForQuery() {
- let startLocation = this._query.filledPoints[0].place.location;
- let endLocation =
- this._query.filledPoints.last().place.location;
+ let startPlace = this._query.filledPoints[0].place;
+ let endPlace = this._query.filledPoints.last().place;
let matchingProvidersForStart =
- this._getMatchingProvidersForLocation(startLocation);
+ this._getMatchingProvidersForPlace(startPlace);
let matchingProvidersForEnd =
- this._getMatchingProvidersForLocation(endLocation);
+ this._getMatchingProvidersForPlace(endPlace);
let matchingProviders = [];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]