fix: ignore null-island location

Closes #149
This commit is contained in:
Jovan Krunić
2021-10-27 13:44:07 +02:00
parent e29a68bb03
commit d3188f5090
6 changed files with 86 additions and 26 deletions

View File

@@ -14,6 +14,7 @@
*/
import {ElementRef, Injectable} from '@angular/core';
import {
SCBuilding,
SCSearchFilter,
SCSearchQuery,
SCSearchResponse,
@@ -24,6 +25,7 @@ import {Point, Polygon} from 'geojson';
import {divIcon, geoJSON, icon, LatLng, Map, marker, Marker} from 'leaflet';
import {DataProvider} from '../data/data.provider';
import {MapPosition, PositionService} from './position.service';
import {hasValidLocation} from '../data/types/place/place-types';
/**
* Provides methods for presenting the map
@@ -125,7 +127,8 @@ export class MapProvider {
}
/**
* Provide places (buildings and canteens)
* Provide places (buildings and canteens) const result = await this.dataProvider.search(query);
*
* @param contextFilter Additional contextual filter (e.g. from the context menu)
* @param queryText Query (text) of the search query
@@ -224,6 +227,12 @@ export class MapProvider {
];
}
return this.dataProvider.search(query);
const result = await this.dataProvider.search(query);
result.data = result.data.filter(place =>
hasValidLocation(place as SCBuilding),
);
return result;
}
}