public async Task <List <Feature> > GetSnappings(string northEast, string southWest) { var northEastCooridnate = new Coordinate().FromLatLng(northEast); var southWestCoordinate = new Coordinate().FromLatLng(southWest); var highways = await _elasticSearchGateway.GetHighways(northEastCooridnate, southWestCoordinate); var points = await _elasticSearchGateway.GetPointsOfInterest(northEastCooridnate, southWestCoordinate, Categories.Points.Concat(new[] { Categories.NONE }).ToArray(), Languages.ALL); return(highways.Concat(points).ToList()); }
/// <inheritdoc /> public async Task <PointOfInterest[]> GetPointsOfInterest(Coordinate northEast, Coordinate southWest, string[] categories, string language) { var features = await _elasticSearchGateway.GetPointsOfInterest(northEast, southWest, categories, language); var points = features.Where(f => f.IsProperPoi(language)).Select(f => ConvertToPoiItem <PointOfInterest>(f, language)).ToArray(); foreach (var pointOfInterest in points.Where(p => string.IsNullOrWhiteSpace(p.Icon))) { pointOfInterest.Icon = SEARCH_ICON; } return(points); }
public void GetSnappings_ShouldGetSome() { var list = new List <Feature> { new Feature(new LineString(new Coordinate[0]), new AttributesTable()) }; _elasticSearchGateway.GetHighways(Arg.Any <Coordinate>(), Arg.Any <Coordinate>()).Returns(list); _elasticSearchGateway.GetPointsOfInterest(Arg.Any <Coordinate>(), Arg.Any <Coordinate>(), Arg.Any <string[]>(), Arg.Any <string>()).Returns(new List <Feature>()); var results = _controller.GetSnappings("0,0", "1,1").Result; Assert.AreEqual(list.Count, results.Count); }
public void GetPointsOfInterest_FilterRelevant_ShouldReturnEmptyElist() { _elasticSearchGateway.GetPointsOfInterest(null, null, null).Returns(new List <Feature> { new Feature { Geometry = new Point(null), Attributes = new AttributesTable() } }); var results = _adapter.GetPointsOfInterest(null, null, null, null).Result; Assert.AreEqual(0, results.Length); }
/// <inheritdoc /> public async Task <PointOfInterest[]> GetPointsOfInterest(Coordinate northEast, Coordinate southWest, string[] categories, string language) { var features = await _elasticSearchGateway.GetPointsOfInterest(northEast, southWest, categories); var tasks = features.Where(f => IsFeatureAProperPoi(f, language)).Select(f => ConvertToPoiItem <PointOfInterest>(f, language)); return(await Task.WhenAll(tasks)); }
public async Task <List <Feature> > GetSnappings(string northEast, string southWest) { var northEastCooridnate = new Coordinate().FromLatLng(northEast); var southWestCoordinate = new Coordinate().FromLatLng(southWest); var highways = await _elasticSearchGateway.GetHighways(northEastCooridnate, southWestCoordinate); var points = await _elasticSearchGateway.GetPointsOfInterest(northEastCooridnate, southWestCoordinate, Categories.Points); return(highways.Concat(points.Where(p => Sources.OSM.Equals(p.Attributes[FeatureAttributes.POI_SOURCE]))).ToList()); }