summaryrefslogtreecommitdiff
path: root/src/photonGeocode.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/photonGeocode.js')
-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);