private IEnumerable <LocatorDetails> Centerlines(AddressBase address)
        {
            var locators = new List <LocatorDetails>();

            if (address.IsReversal())
            {
                AddressPermutations.ForEach(stuff => locators.AddRange(new[]
                {
                    new LocatorDetails
                    {
                        Url = $"http://{Host}/arcgis/rest/services/Geolocators/Roads_AddressSystem_STREET/" +
                              $"GeocodeServer/findAddressCandidates?f=json&Street={HttpUtility.UrlEncode(stuff.Address)}" +
                              $"&City={stuff.Grid}&outSR={stuff.WkId}",
                        Name   = "Centerlines.StatewideRoads",
                        Weight = stuff.Weight
                    }
                }));

                return(locators);
            }

            AddressPermutations.ForEach(stuff => locators.AddRange(new[]
            {
                new LocatorDetails
                {
                    Url = $"http://{Host}/arcgis/rest/services/Geolocators/Roads_AddressSystem_STREET/" +
                          $"GeocodeServer/findAddressCandidates?f=json&Street={HttpUtility.UrlEncode(stuff.Address)}" +
                          $"&City={stuff.Grid}&outSR={stuff.WkId}",
                    Name   = "Centerlines.StatewideRoads",
                    Weight = stuff.Weight
                }
            }));

            return(locators);
        }
Esempio n. 2
0
        /// <summary>
        ///     Determines if the address is likely a reversal
        ///     case 1: (300 S 437 E) where the street name ends in 2,3,4,6,7,8,9
        ///     case 2: (350 S 435 E) where street name and house number both end in a 0 or 5
        /// </summary>
        /// <param name="address">The address.</param>
        /// <returns>locator_SwitchRoadandHouseNumber</returns>
        private IEnumerable <LocatorDetails> Reversal(AddressBase address)
        {
            if (address.IsReversal() || address.PossibleReversal())
            {
                var locators = new List <LocatorDetails>();

                AddressPermutations.ForEach(stuff => locators.AddRange(new[]
                {
                    new LocatorDetails
                    {
                        Url = string.Format("http://{0}", Host) +
                              string.Format("/arcgis/rest/services/Geolocators/Roads_AddressSystem_STREET/" +
                                            "GeocodeServer/findAddressCandidates?f=json&Street={0}&City={1}&outSR={2}",
                                            HttpUtility.UrlEncode(stuff.AddressInfo.ReversalAddress), stuff.Grid, stuff.WkId),
                        Name = "Centerlines.StatewideRoads"
                    },
                    new LocatorDetails
                    {
                        Url = string.Format("http://{0}", Host) +
                              string.Format("/arcgis/rest/services/Geolocators/Roads_AddressSystem_ACSALIAS/" +
                                            "GeocodeServer/findAddressCandidates?f=json&Street={0}&City={1}&outSR={2}",
                                            HttpUtility.UrlEncode(stuff.AddressInfo.ReversalAddress), stuff.Grid, stuff.WkId),
                        Name = "Centerlines.AddressCoordinateAlias"
                    }
                }));

                return(locators);
            }

            return(Enumerable.Empty <LocatorDetails>());
        }
        /// <summary>
        ///     Determines if the address is likely a reversal
        ///     case 1: (300 S 437 E) where the street name ends in 2,3,4,6,7,8,9
        ///     case 2: (350 S 435 E) where street name and house number both end in a 0 or 5
        /// </summary>
        /// <param name="address">The address.</param>
        /// <returns>locator_SwitchRoadandHouseNumber</returns>
        private IEnumerable <LocatorProperties> Reversal(AddressBase address)
        {
            if (!address.IsReversal() && !address.PossibleReversal())
            {
                return(Enumerable.Empty <LocatorProperties>());
            }

            var locators = new List <LocatorProperties>();

            AddressPermutations.ForEach(stuff => locators.AddRange(new[]
            {
                new LocatorProperties
                {
                    Url = $"http://{Host}/arcgis/rest/services/Geolocators/Roads_AddressSystem_STREET/" +
                          $"GeocodeServer/findAddressCandidates?f=json&Street={HttpUtility.UrlEncode(stuff.AddressInfo.ReversalAddress)}&City={stuff.Grid}&outSR={stuff.WkId}",
                    Name = "Centerlines.StatewideRoads"
                }
            }));

            return(locators);
        }