diff options
author | Marcus Lundblad <ml@update.uu.se> | 2021-04-26 23:34:23 +0200 |
---|---|---|
committer | Marcus Lundblad <ml@update.uu.se> | 2021-04-26 23:34:23 +0200 |
commit | d9a22cf05db87c4c15168d1b6d151964901a6a2a (patch) | |
tree | 76ab81d19013dca5e5acd231d1d279b73bf1cdf8 | |
parent | 63720cac2dd78b59c072e11e6d1d66f92596b4bc (diff) | |
download | gnome-maps-wip/mlundblad/use-country-code-from-photon.tar.gz |
transitRouter: Use country code from placewip/mlundblad/use-country-code-from-photon
Use the country code from places in the query
when avaible, before falling back to using
libgweather to guess country/region based on
coordinates.
-rw-r--r-- | src/transitRouter.js | 15 |
1 files 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 = []; |