private async Task RebuildPointsOfInterest()
        {
            _logger.LogInformation("Starting rebuilding POIs database.");
            var osmSource       = _pointsOfInterestAdapterFactory.GetBySource(Sources.OSM);
            var osmFeaturesTask = osmSource.GetPointsForIndexing();
            var sources         = _pointsOfInterestAdapterFactory.GetAll().Where(s => s.Source != Sources.OSM).Select(s => s.Source);
            var otherTasks      = sources.Select(s => _elasticSearchGateway.GetExternalPoisBySource(s));
            await Task.WhenAll(new Task[] { osmFeaturesTask }.Concat(otherTasks));

            var features = _featuresMergeExecutor.Merge(osmFeaturesTask.Result.Concat(otherTasks.SelectMany(t => t.Result)).ToList());

            foreach (var feature in features)
            {
                var geoLocation = feature.Attributes[FeatureAttributes.POI_GEOLOCATION] as AttributesTable;
                feature.Attributes.AddOrUpdate(FeatureAttributes.POI_ALT, await _elevationDataStorage.GetElevation(
                                                   new Coordinate((double)geoLocation[FeatureAttributes.LON], (double)geoLocation[FeatureAttributes.LAT]))
                                               );
                var northEast = _mathTransform.Transform((double)geoLocation[FeatureAttributes.LON], (double)geoLocation[FeatureAttributes.LAT]);
                feature.Attributes.AddOrUpdate(FeatureAttributes.POI_ITM_EAST, (int)northEast.x);
                feature.Attributes.AddOrUpdate(FeatureAttributes.POI_ITM_NORTH, (int)northEast.y);
            }
            await _elasticSearchGateway.UpdatePointsOfInterestZeroDownTime(features);

            _logger.LogInformation("Finished rebuilding POIs database.");
        }
        private async Task RebuildPointsOfInterest()
        {
            _logger.LogInformation("Starting rebuilding POIs database.");
            var fetchTasks = _pointsOfInterestAdapterFactory.GetAll().Select(a => a.GetPointsForIndexing()).ToArray();
            var features   = (await Task.WhenAll(fetchTasks)).SelectMany(v => v).ToList();

            features = _featuresMergeExecutor.Merge(features);
            await _elasticSearchGateway.UpdatePointsOfInterestZeroDownTime(features);

            _logger.LogInformation("Finished rebuilding POIs database.");
        }
Beispiel #3
0
        private async Task RebuildPointsOfInterest()
        {
            _logger.LogInformation("Starting rebuilding POIs database.");
            var osmSource       = _pointsOfInterestAdapterFactory.GetBySource(Sources.OSM);
            var osmFeaturesTask = osmSource.GetPointsForIndexing();
            var sources         = _pointsOfInterestAdapterFactory.GetAll().Where(s => s.Source != Sources.OSM).Select(s => s.Source);
            var otherTasks      = sources.Select(s => _elasticSearchGateway.GetExternalPoisBySource(s)).ToArray();
            await Task.WhenAll(new Task[] { osmFeaturesTask }.Concat(otherTasks));

            var features = _featuresMergeExecutor.Merge(osmFeaturesTask.Result.Concat(otherTasks.SelectMany(t => t.Result)).ToList());
            await _elasticSearchGateway.UpdatePointsOfInterestZeroDownTime(features);

            _logger.LogInformation("Finished rebuilding POIs database.");
        }
Beispiel #4
0
 public IEnumerable <string> GetSources()
 {
     return(_adaptersFactory.GetAll().Where(a => a.Source != Sources.OSM).Select(a => a.Source));
 }