placeEntry: Only use location bias on high zoom
As a stop-gap solution for the location bias
issue in the Photon search engine
(https://github.com/komoot/photon/issues/600),
for now limit the use of location bias to zoom
level above 17.
Ref #172
Marcus Lundblad
2 years ago
117 | 117 | |
118 | 118 | // clear cache when view moves, as result are location-dependent |
119 | 119 | this._mapView.view.connect('notify::latitude', () => this._cache = {}); |
120 | // clear cache when zoom level changes, to allow limiting location bias | |
121 | this._mapView.view.connect('notify::zoom-level', () => this._cache = {}); | |
120 | 122 | } |
121 | 123 | |
122 | 124 | _onSearchChanged() { |
281 | 283 | this._cancellable.cancel(); |
282 | 284 | this._cancellable = new Gio.Cancellable(); |
283 | 285 | this._previousSearch = this.text; |
284 | GeocodeFactory.getGeocoder().search(this.text, | |
285 | this._mapView.view.latitude, | |
286 | this._mapView.view.longitude, | |
286 | ||
287 | /* as a stop-gap solution for the location bias tuning issues | |
288 | * in Photon (https://github.com/komoot/photon/issues/600), | |
289 | * for now search "globally" (e.g. without location bias) for | |
290 | * zoom levels above 17, to still allow focused search nearby | |
291 | */ | |
292 | let lat = this._mapView.view.zoom_level > 17 ? | |
293 | this._mapView.view.latitude : null; | |
294 | let lon = this._mapView.view.zoom_level > 17 ? | |
295 | this._mapView.view.longitude : null; | |
296 | ||
297 | GeocodeFactory.getGeocoder().search(this.text, lat, lon, | |
287 | 298 | this._cancellable, |
288 | 299 | (places, error) => { |
289 | 300 | this._cancellable = null; |