コード例 #1
0
ファイル: Geocode.cs プロジェクト: steveoh/webapi-core
            private IReadOnlyCollection <Candidate> ProcessResult(LocatorResponse response,
                                                                  LocatorProperties locator)
            {
                if (response.Error != null && response.Error.Code == 500)
                {
                    _log.Fatal($"{locator.Name} geocoder is not started.");

                    throw new GeocodingException($"{locator.Name} geocoder is not started. {response.Error}");
                }

                var result = response.Candidates;

                if (result == null)
                {
                    return(null);
                }

                foreach (var candidate in result)
                {
                    candidate.Locator     = locator.Name;
                    candidate.Weight      = locator.Weight;
                    candidate.AddressGrid = ParseAddressGrid(candidate.Address);
                }

                return(new ReadOnlyCollection <Candidate>(result));
            }
コード例 #2
0
        protected IEnumerable <Candidate> ProcessResult(LocatorResponse response)
        {
            if (response.Error != null && response.Error.Code == 500)
            {
                //                    Log.Fatal($"{LocatorDetails.Name} geocoder is not started.");

                throw new GeocodingException($"{LocatorDetails.Name} geocoder is not started.");
            }

            var result = response.Candidates;

            if (result == null)
            {
                return(null);
            }

            foreach (var candidate in result)
            {
                candidate.Locator     = LocatorDetails.Name;
                candidate.Weight      = LocatorDetails.Weight;
                candidate.AddressGrid = ParseAddressGrid(candidate.Address);
            }

            return(result);
        }