Codebase list gnome-maps / 9304650
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
1 changed file(s) with 14 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
117117
118118 // clear cache when view moves, as result are location-dependent
119119 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 = {});
120122 }
121123
122124 _onSearchChanged() {
281283 this._cancellable.cancel();
282284 this._cancellable = new Gio.Cancellable();
283285 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,
287298 this._cancellable,
288299 (places, error) => {
289300 this._cancellable = null;