Example #1
0
        public static MultipleGeocodeAddressResult MapResult(KeyValuePair <int, GeocodeAddressResult> x)
        {
            if (x.Value == null)
            {
                return(new MultipleGeocodeAddressResult
                {
                    Id = x.Key,
                    Score = -1,
                    ErrorMessage = "Address not found"
                });
            }

            if (Math.Abs(x.Value.Score - -1) < double.Epsilon)
            {
                return(new MultipleGeocodeAddressResult
                {
                    Id = x.Key,
                    Score = -1,
                    InputAddress = x.Value.InputAddress,
                    ErrorMessage = "Address not found"
                });
            }

            var result = new MultipleGeocodeAddressResult
            {
                AddressGrid         = x.Value.AddressGrid,
                Candidates          = x.Value.Candidates,
                Id                  = x.Key,
                InputAddress        = x.Value.InputAddress,
                Location            = x.Value.Location,
                Locator             = x.Value.Locator,
                MatchAddress        = x.Value.MatchAddress,
                Score               = x.Value.Score,
                StandardizedAddress = x.Value.StandardizedAddress,
                ScoreDifference     = x.Value.ScoreDifference
            };

            return(result);
        }
        public static MultipleGeocodeAddressResult MapResult(KeyValuePair<int, GeocodeAddressResult> x)
        {
            if (x.Value == null)
            {
                return new MultipleGeocodeAddressResult
                {
                    Id = x.Key,
                    Score = -1,
                    ErrorMessage = "Address not found"
                };
            }

            if (Math.Abs(x.Value.Score - -1) < double.Epsilon)
            {
                return new MultipleGeocodeAddressResult
                {
                    Id = x.Key,
                    Score = -1,
                    InputAddress = x.Value.InputAddress,
                    ErrorMessage = "Address not found"
                };
            }

            var result = new MultipleGeocodeAddressResult
                {
                    AddressGrid = x.Value.AddressGrid,
                    Candidates = x.Value.Candidates,
                    Id = x.Key,
                    InputAddress = x.Value.InputAddress,
                    Location = x.Value.Location,
                    Locator = x.Value.Locator,
                    MatchAddress = x.Value.MatchAddress,
                    Score = x.Value.Score,
                    StandardizedAddress = x.Value.StandardizedAddress
                };

            return result;
        }