示例#1
0
        /// <inheritdoc />
        public async Task <List <Feature> > GetPointsForIndexing(Stream memoryStream)
        {
            var osmNamesDictionary = await _osmRepository.GetElementsWithName(memoryStream);

            var geoJsonNamesDictionary = _osmGeoJsonPreprocessorExecutor.Preprocess(osmNamesDictionary);

            return(geoJsonNamesDictionary.Values.SelectMany(v => v).ToList());
        }
        /// <inheritdoc />
        public async Task <List <Feature> > GetPointsForIndexing(Stream memoryStream)
        {
            var osmNamesDictionary = await _osmRepository.GetElementsWithName(memoryStream);

            var relevantTagsDictionary = _tagsHelper.GetAllTags();
            var namelessNodes          = await _osmRepository.GetPointsWithNoNameByTags(memoryStream, relevantTagsDictionary);

            osmNamesDictionary.Add(string.Empty, namelessNodes.Cast <ICompleteOsmGeo>().ToList());
            RemoveKklRoutes(osmNamesDictionary);
            var geoJsonNamesDictionary = _osmGeoJsonPreprocessorExecutor.Preprocess(osmNamesDictionary);

            return(geoJsonNamesDictionary.Values.SelectMany(v => v).ToList());
        }
        public void GetPointsForIndexing_ShouldGetThem()
        {
            var features = new List <Feature>();

            _latestFileFetcherExecutor.Get().Returns(new MemoryStream());
            _osmRepository.GetElementsWithName(Arg.Any <Stream>()).Returns(new Dictionary <string, List <ICompleteOsmGeo> >());
            _osmRepository.GetPointsWithNoNameByTags(Arg.Any <Stream>(), Arg.Any <List <KeyValuePair <string, string> > >())
            .Returns(new List <Node>());

            var results = _adapter.GetPointsForIndexing().Result;

            Assert.AreEqual(features.Count, results.Count);
        }
        /// <inheritdoc />
        public override async Task <List <Feature> > GetPointsForIndexing()
        {
            _logger.LogInformation("Starting getting OSM points of interest");
            using (var stream = _latestFileFetcherExecutor.Get())
            {
                var osmNamesDictionary = await _osmRepository.GetElementsWithName(stream);

                var relevantTagsDictionary = _tagsHelper.GetAllTags();
                var namelessNodes          = await _osmRepository.GetPointsWithNoNameByTags(stream, relevantTagsDictionary);

                osmNamesDictionary.Add(string.Empty, namelessNodes.Cast <ICompleteOsmGeo>().ToList());
                var features = _osmGeoJsonPreprocessorExecutor.Preprocess(osmNamesDictionary);
                _logger.LogInformation("Finished getting OSM points of interest: " + features.Count);
                return(features);
            }
        }
示例#5
0
        public void GetPointsForIndexing_ShouldRemoveKklRoutes()
        {
            var memoryStream       = new MemoryStream();
            var osmNamesDictionary = new Dictionary <string, List <ICompleteOsmGeo> >
            {
                {
                    "name",
                    new List <ICompleteOsmGeo>
                    {
                        new Node
                        {
                            Id   = 10,
                            Tags = new TagsCollection
                            {
                                { "natural", "spring" },
                            }
                        },
                        new CompleteRelation
                        {
                            Tags = new TagsCollection
                            {
                                { "operator", "kkl" },
                                { "route", "mtb" }
                            },
                            Members = new[]
                            {
                                new CompleteRelationMember {
                                    Member = new CompleteWay(), Role = "outer"
                                }
                            }
                        }
                    }
                },
            };

            _osmRepository.GetElementsWithName(memoryStream).Returns(osmNamesDictionary);
            _osmRepository.GetPointsWithNoNameByTags(memoryStream, Arg.Any <List <KeyValuePair <string, string> > >()).Returns(new List <Node>());

            var results = _adapter.GetPointsForIndexing(memoryStream).Result;

            Assert.AreEqual(1, results.Count);
        }