[gnome-maps/wip/mlundblad/maps-uri: 5/11] graphHopperGeocode: Only include location params when requested
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/maps-uri: 5/11] graphHopperGeocode: Only include location params when requested
- Date: Wed, 3 Nov 2021 23:28:10 +0000 (UTC)
commit 21d38184c6aecfd1676c29ad735f5f6b0a42b10e
Author: Marcus Lundblad <ml update uu se>
Date: Fri Oct 29 23:04:29 2021 +0200
graphHopperGeocode: Only include location params when requested
Only include the the latitude and longitude parameters
when set to non-null in the call.
src/graphHopperGeocode.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/graphHopperGeocode.js b/src/graphHopperGeocode.js
index e63877e4..975cde2e 100644
--- a/src/graphHopperGeocode.js
+++ b/src/graphHopperGeocode.js
@@ -137,11 +137,13 @@ var GraphHopperGeocode = class {
}
_buildURL(string, latitude, longitude) {
- let query = new HTTP.Query({ point: latitude + ',' + longitude,
- limit: string ? this._limit : 1,
+ let query = new HTTP.Query({ limit: string ? this._limit : 1,
locale: this._language,
key: this._apiKey
});
+ if (latitude !== null && longitude != null)
+ query.add('point', latitude + ',' + longitude);
+
if (string)
query.add('q', string);
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]