summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@update.uu.se>2021-10-29 23:06:12 +0200
committerMarcus Lundblad <ml@update.uu.se>2021-11-07 22:29:50 +0100
commit8cc8dd94b49707e53c9144992895184484b65edd (patch)
treea8e7c99079f960f5eaa19b79b3df0a4e091b0064
parent5e031df47e6cbd1e15a0f540bc848813ae7ecaa5 (diff)
downloadgnome-maps-8cc8dd94b49707e53c9144992895184484b65edd.tar.gz
photonGeocode: Only include the location params when requested
Only include the latitude and longitude parameters when specified as non-null in the call.
-rw-r--r--src/photonGeocode.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/photonGeocode.js b/src/photonGeocode.js
index 0de55dd2..38d88ca2 100644
--- a/src/photonGeocode.js
+++ b/src/photonGeocode.js
@@ -135,10 +135,12 @@ var PhotonGeocode = class {
}
_buildURL(string, latitude, longitude) {
- let query = new HTTP.Query({ lat: latitude,
- lon: longitude,
- limit: string ? this._limit : 1
- });
+ let query = new HTTP.Query({ limit: string ? this._limit : 1 });
+
+ if (latitude !== null && longitude != null) {
+ query.add('lat', latitude);
+ query.add('lon', longitude);
+ }
if (string)
query.add('q', string);